So I'm trying to put an Object into an Array for use later and I'm getting an error every time I try. Here's my code:
var children : GameObject[];
var temp : GameObject;
function Start ()
{
children[0] = transform.Find(this.name).Find("Teal Circle Sprite").gameObject;
Debug.Log("Name of object is" + children[0].name);
}
Here's the error that I'm getting:
NullReferenceException: Object reference not set to an instance of an object
Dot.Start () (at Assets/Scripts/Dot.js:8)
Some more information:
The name of the class is Dot and the object in question has a child called "Teal Circle Sprite"
Any help would be great! Sorry I'm kind of new at Unity!
↧