Full SaveManager API
Fields
CurrentSlot
int
Returns Current Slot. Resets to 0 on game restart
LastPlayedSlot
int
Last played slot from the previous session.
Compared to CurrentSlot, this one actually persists between sessions ( it does not reset on starting a new game )
Methods
SetCurrentSlot(int slot)
Sets the active save slot for this session. On starting a new session, Current Slot resets to 0.
SaveAll(int? slot )
Saves the game, if no slot specified uses CurrentSlot
SaveAllAsync(int? slot )
Saves the game state & returns result details ( SaveResult ). If no slot specified uses CurrentSlot
SaveAsync()
Saves to the currently active slot and returns result details
LoadAll(int? slot )
Loads a save game from the provided slot. If no slot specified uses CurrentSlot
LoadWithTransition(int? slot, ILoadTransition transition)
Loads a game with a custom transition effect
LoadWithFade(int? slot, float duration, FadeMode mode)
Loads a save game with a Pre Defined UI fade transition
LoadSceneWithFade(string sceneName, float duration, FadeMode mode)
Loads a scene with a Pre Defined UI fade transition
InstantiatePersistent(string prefabPath, Vector3 position, Quaternion rotation)
Instantiates a prefab that persists ( gets saved into disk )
For Addressables use InstantiatePersistentAsync instead for safer operations
InstantiatePersistentWithCallback(string prefabPath, Vector3 position, Quaternion rotation, Action onComplete)
Instantiates a persistent object with a callback when complete
InstantiatePersistentAsync(string prefabPath, Vector3 position, Quaternion rotation)
Instantiates a persistent object async. Recommended if you are using Addressables
DestroyPersistent(GameObject target)
Destroys a GameObject and marks it as destroyed in the save data
DeleteSaveAsync(int? slot)
Deletes save data for the specified slot.
StartNewSession()
Starts a new game session and enables autosaves
Save(string key, T value, PersistenceScope scope)
Saves a single value programmatically, changes are not effective until SaveAll is called
Load(string key, PersistenceScope scope, T defaultValue)
Loads a single value by key, returns defaultValue if not found
Has(string key, PersistenceScope scope)
Checks if a key exists in the specified scope.
Take into account that the same key can co exist in different Scopes.
Delete(string key, PersistenceScope scope)
Deletes a value by key, changes are not effective until SaveAll is called
Last updated