- Home /
Question by
Enyph-Games · Sep 28, 2016 at 08:05 PM ·
c#unity 5dontdestroyonloadgameobject.find
GameObject.Find Unity 5.3+
I have a GameManager GO with a GameManagerScript on it, and i use DontDestroyOnLoad in that script. GameManager is stored in a DontDestroyOnLoad scene and i want to use GameObject.Find to find a gameobject from Level01 scene. Can anyone show me how to do it? Thanks :)
EDIT
I need to use GameObject.Find in an active scene called Level01 from a GameObject that is in the DontDestroyOnLoad scene
Comment
Answer by tanoshimi · Sep 28, 2016 at 08:29 PM
There's a description and example usage in the docs:
https://docs.unity3d.com/ScriptReference/GameObject.Find.html
Clearly you can only find an object that is currently active in the scene hierarchy (I.e. after Level01 is loaded)