SaveSystemUtils#
- NAMESPACE:
UnityUtils.ScriptUtils.SaveSystem
The SaveSystemUtils script is used in turn with other save systems to assist with save systems. This script is mostly only used in official save system scripts, but could find use in other scripts
Example Usage#
using UnityEngine;
using UnityUtils.ScriptUtils.SaveSystem;
public class ExampleScript : MonoBehaviour
{
void Start()
{
// Gets the global path to the save file "filename.save" in the save slot "0"
string path = SaveSystemUtils.GetSaveSlotFilePath("0", "filename.json");
// Gets the save slot root folder
string saveSlotRoot = SaveSystemUtils.GetSaveSlotRootPath();
}
}
Functions#
- UnityUtils.ScriptUtils.SaveSystem.SaveSystemUtils
Public Static Functions
-
string GetSaveSlotRootPath()#
The full root path for save files, usually Application.persistentDataPath/saves.
-
string GetSaveFilePath(string fileName)#
Generates the full file path for a save file using the specified file name.
- Parameters:
fileName – The base name of the save file
-
string GetSaveSlotFilePath(string saveSlot, string fileName)#
Generates the full file path for a save file using the specified file name and in the save slot.
- Parameters:
fileName – The base name of the save file
saveSlot – The save slot to check
-
string GetSaveSlotPath(string saveSlot)#
Generates the full file path for a saveSlot.
- Parameters:
saveSlot – The save slot to check
-
void LogSaveFileNotFound(string path)#
Logs an error message indicating that a save file was not found at the specified path.
- Parameters:
path – The full file system path of the save file that could not be located
-
void LogSaveFileCreated(string path)#
Logs a message indicating that a save file has been created at the specified path.
- Parameters:
path – The full file system path where the save file was created
-
void LogSaveFileLoaded(string path)#
Logs a message indicating that a save file has been loaded at the specified path.
- Parameters:
path – The file system path of the loaded save file
-
void LogSaveFileEncrypted(string path)#
Logs a message indicating that a save file has been encrypted at the specified path.
- Parameters:
path – The file system path of the loaded save file
-
void LogSaveFileDeleted(string path)#
Logs a message indicating that a save file has been deleted at the specified path.
- Parameters:
path – The file system path of the deleted save path
Public Static Attributes
-
const string SPECIAL_SAVE_FILE_EXTENSION = ".save"#
The default file extension used for save files not needing a specific extension.
-
const string JSON_SAVE_FILE_EXTENSION = ".json"#
.json file extension
-
const string SAVE_FILES_NAME = "saves"#
What to name the save files.
-
const string DEFAULT_SAVE_SLOT_ID = "0"#
The default save slot ID, use when not using multiple save slots.
-
const string SAVE_SLOT_SAVE_FILE_NAME = "save_slot_data.json"#
Save slot save file name.
-
string GetSaveSlotRootPath()#