Search Unity

How do I find all game object possessing the same name?

Discussion in 'Scripting' started by graviton, Oct 23, 2014.

  1. graviton

    graviton

    Joined:
    Jan 11, 2013
    Posts:
    75
    "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
     
  2. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190