how i can get all GameObject (active and inactive) in hierarchy ?
FindSceneObjectsOfTypeAll do this but it has a lots of process and its not usable.
other methods only find active gameobjects.
thanks for help.
how i can get all GameObject (active and inactive) in hierarchy ?
FindSceneObjectsOfTypeAll do this but it has a lots of process and its not usable.
other methods only find active gameobjects.
thanks for help.
// get root objects in scene
List rootObjects = new List();
Scene scene = SceneManager.GetActiveScene();
scene.GetRootGameObjects( rootObjects );
// iterate root objects and do something
for (int i = 0; i < rootObjects.Count; ++i)
{
GameObject gameObject = rootObjects[ i ];
gameObject.DoSomething();
}