- Home /
How do I find all game object possessing the same name?
"GameObject.Find()" only picks one
Please do not recommend Tags to me, that's not what I need here
e.g.
Say I have 200 obj, 100 of them are named Blue and the other 100 are named Red
I want to find all the obj in my scene named Blue and Tag them Blue, find all the obj named Red and Tag them Red
Obviously I want to do all this in code instead of individually finding and Tagging all 200 objects myself in a scene where some of the objects are children of other objects
Ugh.
This is what tags are for. Names are not optimised for this. Set the tag ins$$anonymous$$d of the name.
Note: If you are doing this in the editor you can simply use the search box.
Thanks robertbu
NOTE, I think you added your reply as a comment, so I'm not able to set it as the accepted answer
and
Bored$$anonymous$$ormon I'll try the search box suggestion
Answer by robertbu · Oct 23, 2014 at 08:10 PM
FindObjectsOfType():
http://answers.unity3d.com/questions/570961/gather-all-gameobjects-with-a-certain-name-in-a-sc.html
You'll have to go through the list and find the ones named Blue.
Your answer
![](https://koobas.hobune.stream/wayback/20220613165808im_/https://answers.unity.com/themes/thub/images/avi.jpg)