Unity overrides the null comparison operator for Unity objects, which is incompatible with pattern matching with null.
using UnityEngine;
class Camera : MonoBehaviour
{
public Transform a = null;
public void Update()
{
if (a is not null) { }
}
}Use null comparison:
using UnityEngine;
class Camera : MonoBehaviour
{
public Transform a = null;
public void Update()
{
if (a != null) { }
}
}A code fix is offered for this diagnostic to automatically apply this change.