- Home /
Attempting to Create an Essential SceneElements Checker
Hi all,
I'm making a game with multiple scenes transitions, however I wanted to only have 1 instance of a main camera, a scene controller and perhaps a sound manager at a time during the active scene. I've made it so that the very first scene of the game contains these elements (MainCamera, SceneManager) but not within any other scenes.
I have these elements currently tagged with a do not destroy on load script, and upon scene changes these gameObjects would carry forward in to the next scene.
I wanted to build another failsafe checker for these elements with the logic:
If there is none of these in the scene, create/instantiate one,
If there are more than one, delete the extra.
(This would apply for both Camera and SceneManager)
I'm wondering what is the best approach to do this?
Thanks for your help!
Your answer
Follow this Question
Related Questions
Scene loading problem 5 Answers
Help with error message "Overwriting the same path as another open scene is not allowed" 0 Answers
CheckConsistency: GameObject does not reference component Animator. Fixing. 0 Answers
Scene loads in editor not in build 0 Answers
Bolt Visual scripting and loading different scenes/levels 1 Answer