SaveSystemManager#
- NAMESPACE:
UnityUtils.ScriptUtils.SaveSystem
The SaveSystemManager script is used in turn with other save systems to assist with save systems. This script is used to call the Save() and Load() functions in all scripts inheriting ISaveableData. Also includes some functions that help with getting SaveSlots and SaveDatas
Example Usage#
using UnityEngine;
using UnityUtils.ScriptUtils.SaveSystem;
public class ExampleScript : MonoBehaviour
{
// Create a save slot with the example type "GameData"
SaveSlot saveFile = new SaveSlot("save", SaveSystemManager.CreateSaveData<GameData>(path))
void Start()
{
// Calls all the ISaveableData objects and their Save() function
SaveSystemManager.SaveGame(saveFile);
// Calls all the ISaveableData objects and their Load() function
SaveSystemManager.LoadGame(saveFile);
// Deletes the save slot
SaveSystemManager.DeleteSaveFile(saveFile);
}
}
Functions#
- UnityUtils.ScriptUtils.SaveSystem.SaveSystemManager
Public Static Functions
-
void SaveGame(SaveSlot saveSlot)#
Calls ISaveableData.SaveData<T>(T) on every script inheriting ISaveableData.
- Parameters:
saveSlot – Save slot to save data from ISaveableData’s
-
void LoadGame(SaveSlot saveSlot)#
Calls ISaveableData.LoadData<T>(T) on every script inheriting ISaveableData.
- Parameters:
saveSlot – Save slot to load data from all the ISaveableData’s
-
void DeleteSaveSlot(SaveSlot saveSlot)#
Delete a save slot.
- Parameters:
saveSlot – Save slot to delete
-
List<ISaveableData> FindAllDataPersistanceObjects()#
Gets all ISaveableData to call functions on.
- Returns:
List of all objects with ISaveableData attached
-
Dictionary<string, SaveSlot> LoadAllSaveSlots()#
Loads all save slots from the SaveSystemUtils.SAVE_FILES_NAME directory, if none exist one is created.
- Returns:
Dictionary of the save slot name and SaveSlot
Public Static Attributes
-
bool outputLogs = true
If true will output Debug.Log()’s on Save/Load.
-
void SaveGame(SaveSlot saveSlot)#