Saving and Loading the Scene using PlayMaker

Examples using PlayMaker. Note that to view these examples, you will need to have purchased PlayMaker.
Post Reply
User avatar
Joel
Moodkie Staff
Posts: 4123
Joined: Wed Nov 07, 2012 10:32 pm

Saving and Loading the Scene using PlayMaker

Post by Joel »

Saving and Loading the Scene using PlayMaker

This example demonstrates how you can save the last scene the player entered, and reinsert them into that scene when loading.

This does not save the contents of the scene, only the name of the scene so that they can be reinserted into it. For saving and loading the contents of a scene, please see examples such as this one:

https://moodkie.com/forum/viewtopic.php?f=17&t=1470

IMPORTANT: For this example to work, you need to add MainMenu, Scene1, Scene2 and Scene3 to the 'Scenes in build' section of File > Build Settings.

The project works as follows:
  1. You begin in the Main Menu.
  2. The 'Start New Game' button deletes any existing save data and loads the first scene of the game.
  3. The 'Load Game' button loads the last scene that the player was in. If there's no save data, this button is hidden.
  4. When you press 'Start New Game', you will enter Scene1.
  5. The 'Go to next scene' button takes you to the next scene in the game.
  6. The 'Save scene' button gets the name of the current scene and saves it.
  7. The 'Go to main menu' button takes you back to the main menu.
  8. Scene2 and Scene3 are the same, except Scene3 does not have a 'Go to next scene' button.
Notes
  • The key field on all of your Save and Load actions should be the same. For this example we use the word "CurrentScene" as the key.
  • Instead of having a save button you could instead get it to save in the Start event, depending on what you want to achieve with your project.
Attachments
Saving and Loading the Scene using PlayMaker.unitypackage
(79.13 KiB) Downloaded 37 times
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started

Post Reply