GetRootGameObjects
Returns all the root game objects in the Scene.
Read time 1 minuteLast updated 9 days ago
Definition
- Type: Method
- Namespace: UnityEngine.SceneManagement
- Assembly: UnityEngine.CoreModule
GetRootGameObjects()
Returns all the root game objects in the Scene.
public GameObject[] GetRootGameObjects()
Returns
Type | Description |
|---|---|
| GameObject[] | An array of game objects. |
GetRootGameObjects(List<GameObject>)
Returns all the root game objects in the Scene.
public void GetRootGameObjects(List<GameObject> rootGameObjects)
Parameters
A list which is used to return the root game objects.
Remarks
Please make sure the list capacity is bigger than Scene.rootCount, then Unity will not allocate memory internally.