SaveSystem

Overview

The SaveSystem class is a part of the save system in your game. It is responsible for saving and loading game data. It uses the JsonUtility class from the UnityEngine namespace to convert objects to JSON format and vice versa.

Properties

saveFileName

This is a public property of type string. It is used to specify the name of the save file.

ActiveProfile

This is a public property of type string. It is used to store the name of the active profile.

ActiveSaveFile

This is a public property of type string. It is used to store the name of the active save file.

Subfolder

This is a public static property of type string. It is used to specify the subfolder for the save files.

ShouldSaveScreenshot

This is a public property of type bool. It is used to determine whether a screenshot should be saved.

Methods

Save(SaveType saveType, string lastStage = "", string profileName = null, string customName = null)

This method is used to save the game data. It takes a SaveType enum, a string for the last stage, a string for the profile name, and a string for the custom name as parameters.

LoadLatestSave(string profileName = null)

This method is used to load the latest save. It takes a string for the profile name as a parameter.

LoadLatestSaveAcrossProfiles()

This method is used to load the latest save across all profiles.

Load(string profileName = null, string saveName = null)

This method is used to load a save. It takes a string for the profile name and a string for the save name as parameters.

HasSave(string profileName = null)

This method is used to check if a save exists. It takes a string for the profile name as a parameter and returns a bool.

GetUniquePlayerName(string basePlayerName)

This method is used to get a unique player name. It takes a string for the base player name as a parameter and returns a string.

DeleteAllSaveData()

This method is used to delete all save data.

DeleteProfile(string profileName)

This method is used to delete a profile. It takes a string for the profile name as a parameter.

Events

This asset uses basic C# events, for a custom Event system that is more flexible check out oue EventForge asset. (FREE)

OnSave

This is a public static event of type SaveLoadDelegate. It is invoked when the game data is saved.

OnLoad

This is a public static event of type SaveLoadDelegate. It is invoked when the game data is loaded.

This page was last edited on 2024-03-09 11:48

Powered by Wiki|Docs

This page was last edited on 2024-03-09 11:48

BiteMe Games
2024

Powered by Wiki|Docs