- Home /
SetActive() Object reference not set to an instance of an object.
GameObject Cube = GameObject.Find("Cube");
Cube.SetActive(false);
I have this in my FixedUpdate, and the Cube gameobject is loaded but it still says object reference not set to an instance of an object.
Comment
Best Answer
Answer by _MGB_ · Sep 14, 2014 at 10:13 AM
When you call SetActive(false) on an object it is totally removed from the scene. Therefore on the second time through your FixedUpdate it will be unable to find a "Cube" game object.