文档

Unity Engine

Unity Engine

GetRootGameObjects

Returns all the root game objects in the Scene.
阅读时间1 分钟最后更新于 1 个月前

Definition

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

rootGameObjects

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.