I have multiple object of the same name and tag, with an identical script attached, and I want to call a method in the script for each object all at once, I can get send message to work but only for 1 object (using GameObject .Find(“Fuze”).SendMessage(“FuzeOn”, true) but how to address all instances of the object Fuze?
Hey there Ian,
If all your objects have the same tag you can find them all with this,
GameObject.FindGameObjectsWithTag() will return an array of objects which you can loop through sending a message to each object.
Try something like this…
GameObject[] taggedGameObjects = GameObject.FindGameObjectsWithTag("FuzeTag");
for(int i=0; i<taggedGameObjects.Length; i++)
{
taggedGameObjects*.SendMessage("FuzeOn", true);*
}
Hope this helps.
Phill