How i can find all gameObject with a certian tag in the scene and store them in a array?
2 Answers
2One line:
GameObject[] objects = GameObject.FindGameObjectsWithTag("myTag");
Note: Code is C#
http://unity3d.com/support/documentation/ScriptReference/GameObject.FindGameObjectsWithTag.html
var objects : GameObject;
function Start()
{
objects = GameObject.FindGameObjectsWithTag(“Tag”);
}
Going to sound stupid, but what's the equivilent of this line in Javascript? guessing it's var object : GameObject[] = GameObject.FindGAmeObjectsWithTag("MyTag"); but didn't see an exact reference for it when it came to arrays...
– Se7eNJinx