how to loop through gameobject in unity code example
Example 1: unity3d loop over all gameobjects
object[] obj = GameObject.FindSceneObjectsOfType(typeof (GameObject)); foreach (object o in obj) { GameObject g = (GameObject) o; Debug.Log(g.name); }
Example 2: iterate througha game object in unity
for(int i = 0; i < gameobject.transform.GetChildCount(); i++)
{
Transform Children = gameobject.transform.GetChild(i);
}