GameObject.Find doesn't return elements of new scene
I want to be able to use one GameManager across different scenes. When I switch the scene I'm trying to access the first child of a panel. In the old scene it's an image, in the new one it's a text. When I log
Debug.Log(GameObject.Find("Canvas").transform.GetChild(0).GetChild(0));
I get an Image. I've tried accessing the new scene like this:
GameObject[] goArray = SceneManager.GetSceneByName("QuizLoseScene").GetRootGameObjects();
but I get an empty array. I did set DontDestroyOnLoad(gameObject)
on my GameManager. How can I access elements loaded in the new scene? What is the best practice to handle scenes going in circles (as in quiz games, one scene is a question, another is right/wrong screen and player gets at least 3 rounds of these scenes)?
Your answer
Follow this Question
Related Questions
GameObject.Find throws be a error when trying to find a child. 1 Answer
setting a variable to a GameObject that has a certain RGB value??? please help 0 Answers
How Can I assign a gameobject via script? 0 Answers
(Solved) Findout if an object exist in the scene, but dont trow exception 1 Answer
Trouble with GameObject.Find() After LoadLevel.Load() 0 Answers