Parse Scene Hierarchy

Hi everybody.

I’m really sorry to bother all of you with what I think is a very noobie question, but I can’t found any answer about it on the internet so …

I would like to know if there is a way to recursivly parse the Scene Hierarchy in Unity, in order to, for instance, find specifics Games Components.

Something like

for(int i=0;i<Hierarchy.ChildCount; i++)
{
    RecursivFunction(Hierarchy.Child(i));
}

Thanks for your attention!

To find specific components, you can use:

FindObjectOfType( typeof(YourTypeHere) ); // returns the first object of this type
FindObjectsOfType( typeof(YourTypeHere) ); // returns an array will all objects of this type

See http://unity3d.com/support/documentation/ScriptReference/Object.FindObjectOfType.html and http://unity3d.com/support/documentation/ScriptReference/Object.FindObjectsOfType.html.

GameOject.Find methods can also be of some help.