[DEV] Save Between Scenes


When completing level 1, you enter a new scene that represents level 2. Since unity unloads level 1, and level 1 and 2 are not synced, we needed a way to save everything that we needed to know from scene 1 and apply that to scene 2.

This can be done by saving all the variables to our GameManager, since this manager does stay loaded, and load the variables back into the corresponding scripts. This way we can keep our Inventory the same, which means your stats from level 1 will be saved when going to level 2, just like you keep your learned abilities and Spawn Position.

It was necessary to save the variables, so that we could later write a Save file that’s stored locally, which would allow the player to continue from where he last left the game. Saves won’t occur regularly though, only predefined checkpoints and the transition to a new level will be seen as a point where the player information is saved.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s