DataPersistenceManager

The DataPersistenceManager interacts with the FileDataHandler to manage data encryption and decryption, allowing the GameDataManager to process and load game data seamlessly.

Saving & Loading the Game programmatically

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.

using cowsins.SaveLoad; // Required to access DataPersistenceManager

Saving Games Programmatically

DataPersistenceManager.instance.SaveGame();

Loading Games Programmatically

DataPersistenceManager.instance.Loadame();

Profile ID Management in Save & Load System

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.


CONFIGURATION

  • dataPersistenceSettings: Defines General Settings for the Save & Load. These settings can be configured in the Save & Load Tab of the Cowsins Manager. Check DataPersistence_SO for more information.

Functions | DataPersistenceManager.cs

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

Last updated