Home > Net >  Why is the object on the scene null?
Why is the object on the scene null?

Time:05-24

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

CodePudding user response:

Have you assigned Diam in the Inspector?

CodePudding user response:

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

  • Related