I can’t find this in the documentation? I’ve written
private var planets : GameObject[];
...
function start()
{
setSizes();
createHexes(); //this creates the hexes (sectors) with 0 to 3 planets on them
planets = GameObject.FindGameObjectsWithTag("Planet");
print (planets.length);
}
But when I check the array to see if it contains the planets, it’s empty. The planets are tagged properly.
Each planet is a child of another object (sector). Sometimes there are more than one child planets to the parent object.
edit: I just saw that it works if I put it into update, but I don’t need it to constantly do it. Only once, at the start. But it just returns an empty array. Same if I put it up awake, or split them up and put setSizes and createHexes in awake and my other code in Start