Unity overrides the null comparison operator for Unity objects, which is incompatible with null propagation.
using UnityEngine;
class Camera : MonoBehaviour
{
public Transform NP()
{
return transform?.transform;
}
}
Use null comparison:
using UnityEngine;
class Camera : MonoBehaviour
{
public Transform NP()
{
return transform != null ? transform : null;
}
}
A code fix is offered for this diagnostic to automatically apply this change.