Proposal: Require / enforce additive scene loading via scene service
Overview
Unity suggests using a base manager scene and additively loading / unloading content on top of that. In theory we recommend this approach but in practice our story is muddled.
Docs and editor prompts should make it clear that single-scene loading is not officially supported and that MRTK instances / services will be (gracefully) destroyed by single loads. DontDestroyOnLoad should never be used in any case by core services or scripts.
Scene service / Manager vs Content scenes
A scene management core service should be created to enforce this convention. Like all core services it should be possible to disable and ignore, but using it would make loading / unloading additive scenes simpler both at runtime and in editor.
The profile for this service would require devs to specify a 'Manager' scene - the presence of an MRTK instance would be enforced in this scene.
All other scenes would be considered 'Content' scenes - these can contain MRTK instances if devs want to quickly test them in isolation, but those instances would be ignored when additively loaded.
The service should also help devs avoid common multi-scene gotchas like enforcing lighting settings across multiple scenes, navmesh settings, etc.
Multiple MRTK instances in editor
To avoid confusion in cases where multiple MRTK instances are loaded across multiple scenes in the editor, one instance would be visibly 'active' (either an arbitrary instance or the Manager instance if present) while the rest would be visibly 'disabled.'
Add 'OnSceneAdded / OnSceneRemoved' to service interfaces
Services should be able to handle the loading and unloading of content gracefully. Adding these methods to the base service interface would set that expectation.
Related: #3639, #3601, #3599, #3261, #3246, #3941
Assigning to @Yoyozilla to schedule the associated work.
We've seen many customers struggling with multi-scenes applications in HoloToolkit (Camera management, Cursor/Controller/Focus management, Services management...) Definitely, it would be really helpful to provide clear guideline and methods for it.
I think creating a scene loading service is overkill and a bit over engineered. SceneManager should be enough and we shouldn't rewrite(overwrite) how the editor handles this functionality.
The only real problem is during development, when devs are moving between scenes in the editor.
I've already had plans to support this for some time and in my fork, I've set it up to that developers need only press play and the base scene automagically loads in for them and they don't have to worry about anything.
I setup the Start Scene editor preference which automatically sets that scene to the 0 index of the build scenes, so that it's the first loaded in the built player.
Then when a user presses configure... it sets that scene to the Start Scene preference.
When a user switches to a new scene, then presses play, the editor will additively load in the start scene for them and all will work fine.
If no start scene is exists, then it prompts the user if they'd like to configure the scene.
SceneManager should be enough
I'd agree if not for the friction @cre8ivepark and others have observed with multi-scene management in the wild.
Even if they're not outright intimidated by the concept, people get confused by all the random gotchas like IsLoaded and the sceneLoaded event not being strictly coordinated, the weird 0.9 cutoff for scene activation, scenes not having names until loaded, etc etc just to name a few.
A basic wrapper that handles the boilerplate stuff on their behalf would go a long way. And the beauty of services is they can always shut it off.
@StephenHodgson I just took a look at your fork and I really like where you're going with it.
I'm torn between enforcing a single instance vs. disabling instances like we're proposing. Your method of inserting the start scene at index 0 and loading it automatically in editor is pretty great. I'm still leaning towards multi-instance just because that feels less intrusive, but after seeing your implementation I'll have to mull it over.
I also noticed that you solved the problem of tagging the main camera on startup without causing the warning we were seeing in our camera cache PR. I didn't realize you could pass the tag value to a component in that way, pretty neat.
updating status since Lars is working on this.