Save & Load Games Programmatically
With the Save & Load Add-On, saving and loading games is very easy!
To save and load your game, you will need to access the DataPersistenceManager
. Whenever you're working with or coding for the Save & Load Add-On, be sure to include the cowsins.SaveLoad
library at the top of the script.
using cowsins.SaveLoad; // Gives us access to DataPersistenceManager
After that, just call either SaveGame()
or LoadGame()
, depending on whether you want to save or load the game.
Saving Game through DataPersistenceManager
DataPersistenceManager.instance.SaveGame();
Loading Game through DataPersistenceManager
DataPersistenceManager.instance.LoadGame();
Examples of Scripts that Programmatically Save or Load the Game
In case you want to take a look at a script provided within the Save & Load Pro Add-On that handles Save & Loading programmatically, you can check SaveTrigger or LoadTrigger.
More Important Information
To successfully add Custom Implementations with Save & Load Pro Add-On, you need to understand how the system works. Please, refer to the following Documentation Sections for further explanation:
Understanding how the Entire System works: 03.1 Data Persistence
Last updated