- Home /
Simple questions about scenes
Just a few brief questions I still have after going through the tutorials.
Changing scenes in the editor seems to swap out the items in the hierarchy view. That's fine, but is there a way to have root-level, project-level game objects?
If the answer to the above is no, does that mean I have to connect to my server anew for each scene? What if I have a main scene and a second scene open for options and they both need server connections?
Thanks for your time to help me with this.
Answer by rutter · Aug 01, 2014 at 03:06 AM
is there a way to have root-level, project-level game objects?
Not exactly, no. It's a limitation in Unity's design.
Once an object is loaded, you can tell Unity to keep it between level loads by calling DontDestroyOnLoad. Unfortunately, there's no built-in way to make sure that a particular object exists in every level.
Some people just make sure to drop a particular prefab into every level. If you prefer a code-based solution, though, you might employ a singleton design pattern:
Your answer
Follow this Question
Related Questions
Door Between Scenes 3 Answers
How can i stop a scene to wait the result of another scene ? 0 Answers
How do I reset part of a scene? 1 Answer
Addressable for Oculus Go 2 Answers