MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

Best way to change back and forth between scenes?

Open dtb49 opened this issue 8 years ago • 5 comments

So, I am working on a project and the entire time it has been basically in only one scene and that has worked fine. However, I am trying to add a tutorial like scene to introduce the user to the controls. Once they finish going through the tutorial they will go back to the start up. What I have come to notice that because the InputManager persists through scene changes you need the camera and cursor to do so as well otherwise it throws a bunch of different errors that are really hard to track down why they are happening. By making the camera and cursor DontDestroyOnLoad it has solved the issue of going to a different scene. However, whenever I go back to the first scene, Unity basically yells at me for having two cursors and cameras in the scene. What is a workaround for this? Am I going about doing this the right way? Is there a certain way that we should handle scene changes?

dtb49 avatar Apr 18 '18 15:04 dtb49

You can look at the way GalaxyExplorer handles this. Basically it has a scene called CoreSystems that is responsible for all of the MRTKish Singletons. Every other scene in the project has a script called ViewLoader that checks to see if CoreSystems is loaded. If it isn't that script loads CoreSystems before it proceeds.

timGerken avatar Apr 19 '18 08:04 timGerken

This is referenced in #1823 with some possible fixes listed

beccannlittle avatar Apr 20 '18 22:04 beccannlittle

Discussed in #1823 and I tried it in my personal project. Have a Master scene with common elements only, such as MixedRealityCamera, InputManager, DefaultCursor then, load the first scene and replace with other scenes. (SceneManager.UnloadScene/LoadScene)

cre8ivepark avatar Apr 24 '18 17:04 cre8ivepark

Probably best to have a master scene, and additive load and unload as needed.

StephenHodgson avatar Apr 24 '18 18:04 StephenHodgson

Closing issues older than 180 days. If this is still an issue, please reactivate with recent information.

wiwei avatar Apr 11 '19 20:04 wiwei