Sub Scene

Is there a graceful way of starting with one scene, then loading a second scene, and finally returning to the first scene as it was when the second scene was loaded? Basically, if you want something like a sub-game that returns to the original game.

I know how to switch between scenes and keep information (such as returning the results of the sub-game), and I could imagine using this to store the full state of the world and simply reinstating it all by hand (or save and load although I haven’t looked into Unity serialization much), but this seems like a very nasty solution which wouldn’t scale very well as more modules were created and added into the scene.

I don’t think LoadLevelAdditive will help as it keeps the previous scene active, unless there is a way to pause all of the old content and just load the scene sufficiently far enough away that they couldn’t interact or something. Similarly, the DontDestroyOnLoad allows you have objects persistent through scenes, but runs into the same problems with the LoadLevelAdditive solution.

So it’s not just that you want to conserve all the old stuff, but you want it to pause.

Well you answered half your question, as you found a way to conserver all your old stuff. You just need a way to pause all said stuff.

A simple way to pause everything is to just make them all inactive. So flag everything inactive, load up the new stuff, when done, deactivate all that, and reactivate all the previous stuff.

Thanks. It feels weird, but I can hack this problem by setting all objects inactive, then loading additive for the new scene. Also, as a note for anyone else trying to do this, make sure you keep a list of the inactive objects because find does not work on inactive objects for when you want to reconstruct them.