[HOWTO] How To: Change Scenes With Save System
Posted: Thu Dec 24, 2020 9:20 am
When changing scenes, you can use the Pixel Crushers Save System to record the state of the old scene before leaving, and then restore the saved state of the new scene after entering. Otherwise, when you leave the old scene, you'll lose the player's progress in it; and when you enter the new scene, it will have its original design-time state without any progress that the player may have made in it.
To change scenes with the save system, use any of these techniques:
After changing scenes, call:
See also:
To change scenes with the save system, use any of these techniques:
- In C#: PixelCrushers.SaveSystem.LoadScene("sceneName") or LoadScene("sceneName@spawnpoint")
- In a sequence: LoadLevel("sceneName") or LoadLevel("sceneName", "spawnpoint")
- Using a Scene Portal component.
- By calling SaveSystemMethods.LoadScene (e.g., add to a UI Button and call in OnClick() event).
Code: Select all
PixelCrushers.SaveSystem.RecordSavedGameData();
PixelCrushers.SaveSystem.BeforeSceneChange();
Code: Select all
PixelCrushers.SaveSystem.ApplySavedGameData();
- How To: Prevent Scene Changes From Incrementing Quests
- Dialogue System Extras: Preconfigured prefabs and animations for Save System, scene transitions with intermediate loading screen, and Scene Portals.