Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unity moving to another scene with current scene being paused

Tags:

unity3d

I'm making a turn-based battle game in Unity3D and I have 2 scenes (a town scene and a battle scene). Whenever the character meets a monster, the game jumps to the battle scene where the character does battle and go back to the town scene after defeating or losing.

The problem is how to return to the town scene with the same state as when the character enters the battle scene (character position, statuses, etc.)

if I use

Application.LoadLevel('battlescene');

then

Application.loadLevel('townScene');

then the townscene will start from the first time. How to make the townscene continue from where we left off?

like image 872
Jason Avatar asked Nov 21 '12 05:11

Jason


1 Answers

I know this is an old post, but there is one more method that can be used. This would be to save the state of the scene. This comes in handy when you don't expect users to have the resources for loading 2 scenes with the Application.LoadLevelAdditive. That method potentially can use twice the resources.

When you save the state (save all information that can change to a file or DB) you can then load the level at a later time and not have it sitting in memory. You could also use this to save your game.

like image 187
Casey Estes Avatar answered Feb 23 '23 22:02

Casey Estes