Why is the object on the scene null?

Viewed 26

I have an object named "Diam" on the scene. Why the first if is triggered and not else. After all, Diam is on the stage, it should not be equal to zero? P.S. Okay, let it be null. Question: What did we check then?

public class CircleCode : MonoBehaviour{
    public GameObject Diam;

    void Start() {
        if (Diam == null){
            Debug.Log("Diam == null");
        } else {
            Debug.Log("Diam is not null");
        }
    }
}

It's my objects

2 Answers

Have you assigned Diam in the Inspector?

Select CircleCode and Drag Diam game-object on Diam field in inspector.

Related