- Home /
Question by
$$anonymous$$ · Jun 05, 2020 at 07:51 PM ·
gameobjectfind
Alternatives to GameObject.Find();
I am trying to load different levels in my puzzle game, but when I hide the levels that aren't being used, GameObject.Find();
does not work. Is there a way to substitute this function for one that can find objects that are hidden?
Comment
Answer by Aviryx · Jun 05, 2020 at 08:00 PM
Resources.FindObjectsOfTypeAll
https://docs.unity3d.com/ScriptReference/Resources.FindObjectsOfTypeAll.html
Returns a list of all objects of Type T.
This function can return any type of Unity object that is loaded, including game objects, prefabs, materials, meshes, textures, etc. It will also list internal objects, therefore be careful with the way you handle the returned objects. This function will also list disabled objects.