- Home /
Question by
Vipul-Dudharejiya · Jul 20, 2015 at 09:59 AM ·
scenenamecountgame object
How to count and name total number of game object are there in my scene?
So basically i just want to count how many game object are there in my scene. Is there any special built in function ?
Comment
Answer by BiG · Jul 20, 2015 at 09:59 AM
This should work:
GameObject.FindObjectsOfType(typeof(MonoBehaviour)); //returns Object[]
See here for other solutions: http://answers.unity3d.com/questions/329395/how-to-get-all-gameobjects-in-scene.html.
I would search for Transform ins$$anonymous$$d, since every GameObject has a Transform component, but not every GameObject might have a $$anonymous$$onoBehaviour component.