Save System
The Save System allows persistent saving and loading of component state across scenes.
Components
ISaveable
Interface to make a behaviour's state persistent.
Must define a
SaveId(string) and state serialization logic.
SaveableMonoBehaviour
Base
MonoBehaviourimplementingISaveablefor convenience.Override save/load methods to store component-specific data.
SaveManager
Central controller that manages all
ISaveablecomponents in the scene.Assigns unique IDs and coordinates save/load operations.
Editor inspector includes:
Assign SaveIds to All Saveables – Generates IDs for unassigned components.
Clear and Reassign – Resets IDs and clears stored preferences.
SaveManagerUI
Optional UI component to expose save/load/reset actions to the player.
SavePrefs
Static helper for storing save data in
PlayerPrefs.Includes
ResetAll()to clear all stored state.
Example Workflow
Add
SaveManagerto your scene.Implement
ISaveableon components whose state should persist.Tip: inherit from
SaveableMonoBehaviourfor clean integration with Unity callbacks.
Auto-assign unique
SaveIds to each object using theSaveManagerInspector component.Call
SavePrefsmethods or useSaveManagerto save/load.Add an optional button to your in-app UI to call
SaveManager.ResetAllSaveables().
Example Code
Last updated