DataPersistenceManager
Last updated
Last updated
The DataPersistenceManager
interacts with the to manage data encryption and decryption, allowing the to process and load game data seamlessly.
IMPORTANT: The DataPersistenceManager
must exist in the scene for data to be saved.
You don’t need to manually add the DataPersistenceManager
to each scene, as it is marked with [DontDestroyOnLoad]
. Simply place the DataPersistenceManager
in your Main Menu scene. When starting the game in a gameplay scene, data won’t be saved. However, when starting from the Main Menu, the DataPersistenceManager
will persist across different scenes, ensuring data can be saved.
In Save & Load Pro Add-On, saving the game is very simple! You can access DataPersistenceManager.cs Singleton to Save & Load the game with a single line of code.
Only the Data Stored in GameDataManager will be saved into the Game Data Json, so make sure to Store the Required Data, otherwise nothing will be saved.
In order to access DataPersistenceManager, ensure to add the following library on top of your Script:
The DataPersistenceManager
manages Profile IDs and interacts with the Save & Load Pro Add-On to handle data operations across different save slots. It maintains a Profile ID to monitor the current save slot, allowing for specific operations based on this ID. The Profile ID remains unchanged during gameplay and can only be modified from the Main Menu when selecting a different save slot.
ChangeSelectedProfileId(string newProfileId)
Selects a new Save Slot.
newProfileId: New Save Slot Index.
SaveGame()
Saves the Game ( Saves the Stored Data in GameDataManager into a Json file that corresponds to the current Profile ID )
LoadGame()
Loads the Game ( Loads the Data from the Json file that corresponds to the current Profile Id )
HasGameData() | Returns Bool
Returns False if the Game Data is empty or null.
GetLastUsedProfileID() | Returns String
Returns the most recently played Profile ID ( That corresponds to a Save Slot )
IsAutoSaveEnabled() | Returns Bool
Returns true if Auto Save is enabled.
EnableAutoSave()
Enables Auto Save.
DisableAutoSave() |
Disables AutoSave
IsNonSaveableScene() | Returns Bool
Returns true if the current scene should not implement Save & Load Functionality.
GetCurrentGameData() | Returns GameData
Returns Current Game Data
dataPersistenceSettings: Defines General Settings for the Save & Load. These settings can be configured in the Save & Load Tab of the Cowsins Manager. Check for more information.