I'm making a game with multiple scenes transitions in Unity 2018.1.6 with C#, 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!