So basically i just want to count how many game object are there in my scene.
Is there any special built in function ?
1 Answer
1This should work:
GameObject.FindObjectsOfType(typeof(MonoBehaviour)); //returns Object[]
See here for other solutions: How to get all GameObjects in Scene? - Unity Answers.
I would search for Transform instead, since every GameObject has a Transform component, but not every GameObject might have a MonoBehaviour component.
– ChernoPage Not Found
– Vipul-DudharejiyaNevertheless, BiG's answer is correct.
– ChernoRemove the final dot from the URL.
– BiGhummm... got it and done.
– Vipul-Dudharejiya