- Home /
Details on how scenes work?
Still reading up on Unity.... Can multiple scenes be loaded and running at the same time? Can I switch from one scene to another and then return back and the original scene in the state I left it? (switch from scene A to scene B and then return back to A having it preserved from when I left it) Can I suspend or keep multiple scenes running so scripts attached to GOs in all scenes can execute?
Answer by fafase · Oct 13, 2014 at 05:57 AM
I don't think you can keep scene open on the back, at least I can see it anywhere. You can use:
http://docs.unity3d.com/ScriptReference/Application.LoadLevelAdditive.html
but I don't think that is what you are after.
What you want is to start a scene and on a particular state you want to start a new scene with the previous still running, I would recommend to have only one scene but two separate zones. Instead of loading the new scene, you just move the camera to the next zone and switch the control back and forth, or move the whole player depending on what you want to do. But that may be heavy on the performances you know,if everything is doubled.
Answer by HarshadK · Oct 13, 2014 at 06:31 AM
For:
Can I switch from one scene to another and then return back and the original scene in the state I left it? (switch from scene A to scene B and then return back to A having it preserved from when I left it)
you can do it using the game state save mechanism. You can use a readymade option like Unity Serializer or you can write one as per your need. In this case when you leave scene A save its state and then go to scene B. Now when you come back to scene A you can load the scene again to resume from where you left.
For:
Can I suspend or keep multiple scenes running so scripts attached to GOs in all scenes can execute?
For this you can use LoadLevelAdditive as suggested by @fafase. So you can load and run multiple scenes. For suspending and handling scenes you might need write a scene manager that will handle all the game objects and other things from all these scenes and will disable all the GOs etc from a particular scene that you want to suspend.
Your answer
Follow this Question
Related Questions
Is it possible to have multiple scenes saved in memory? 1 Answer
How do I refer to a .text from a separate scene. 0 Answers
[Question] mp3player, my own music in unity game. 0 Answers
How to take a GameObject from A scene to B scene when the GO was instantiated? 1 Answer
Keeping Scene States 2 Answers