Help with None vs Null

Hi All,

Can someone help me understand why the ‘box’ evaluates to !null in the coalescing operator but evaluates to null in an ‘if ()’ check?

public class Test : MonoBehaviour
{
    public void Update()
    {
        // Will assign 'T' the value of 'target'.
        GameObject T = target ?? new GameObject();

        // ... but....

        // Will evaluate to true.
        if (null == target)
            print("Target is null!");
    }

    [SerializeField] protected GameObject target;
}

The help is greatly appreciated.

Thanks,

Unity overloads the “==” operator for Objects.

http://blogs.unity3d.com/2014/05/16/custom-operator-should-we-keep-it/

I can’t really explain why, or what’s going on. But I know the question has been asked numerous times here on Answers and in the forum.

http://answers.unity3d.com/questions/586144/destroyed-monobehaviour-not-comparing-to-null.html