![]() |
Pro Reset Game
|
Manages capture, persistence, and restoration of game state for the current Unity scene. Feature overview. More...
Classes | |
| class | SaveEntry |
| Bundles a single target variable for explicit serialisation. More... | |
Public Member Functions | |
| void | RecordState () |
| Captures game state using the enabled mechanisms and immediately commits it to disk. | |
| void | LoadState () |
| Loads persisted state from disk and restores it into the current scene objects. | |
| void | Save_SaveFileToDisk (int saveSlot) |
| Convenience wrapper that records state and saves it to the specified slot ID. | |
| void | Load_SaveFileFromDisk (int saveSlot) |
| Loads a save file corresponding to saveSlot or the newest timestamped file when unlimited slots are enabled. | |
| List< string > | GetAllSaveFileIDs () |
| Returns all IDs currently present on disk that match SaveSlotName. | |
| bool | DeleteSaveFile (string id) |
| Deletes a specific save file by its ID. | |
| void | DumpSavedDataToConsole () |
Public Attributes | |
| bool | SaveAllSerializableFields = false |
| Toggle that determines whether SaveAllSerializableFieldsFromList/… should dump all serialisable fields from the list or hierarchy search. (All components in-scene) | |
| bool | SaveEverySingleComponentOrComponentInList = true |
When true, ComponentListToSaveEveryThing is used verbatim; when false, the component list is built automatically with Object.FindObjectsOfType<T>(bool). (Searching All components in-scene) | |
| List< Component > | ComponentListToSaveEveryThing = new List<Component>() |
| Explicit set of MonoBehaviours whose fields will be saved/reloaded when SaveEverySingleComponentOrComponentInList is enabled. | |
| bool | IncludeBuiltinComponentProperties = true |
| bool | useSaveEntries = true |
| Master switch for SaveEntry-based serialisation. | |
| List< SaveEntry > | saveEntries = new List<SaveEntry>() |
The list of variables that will be saved and restored when useSaveEntries is true. | |
| bool | useSaveableAttributes = true |
Enables scanning for fields decorated with [Saveable]. | |
| bool | SaveEverySingleAttributeComponentOrComponentInList = true |
When enabled, only the components in serializableFieldComponents are inspected for [Saveable] fields. When disabled, every MonoBehaviour in the scene is scanned. | |
| List< MonoBehaviour > | serializableFieldComponents = new List<MonoBehaviour>() |
Manual list of components to scan for [Saveable] fields when SaveEverySingleAttributeComponentOrComponentInList is enabled. | |
| bool | EnableSaveSlots = false |
| Enables numeric save slots (bounded by AmountOfSaveSlots). | |
| bool | InfiniteSaveSlots = false |
| Allows unlimited slot IDs by timestamping filenames instead of clamping to AmountOfSaveSlots. | |
| int | AmountOfSaveSlots = 3 |
Maximum number of slots when EnableSaveSlots is true and . | |
| int | SlotsToSaveTo = 1 |
| Index used for the next save/load call when the UI selects a slot. | |
| string | SaveSlotName = $"Saveata_%INEX%.json" |
Filename pattern used for all save operations. The token INDEX% is replaced with a slot ID or timestamp (depending on slot mode). Checks to ensure that .json is at the end and that only one . is present in file is done. Warning in editor or console error at awake. | |
| bool | EnableFileEncryption = true |
| Enables AES-256-CBC encryption during disk IO. | |
| string | encryptionPassword = "" |
| 48-character password; the first 32 chars form the AES key, the last 16 form the IV. Required 48 characters, nothing shorter or longer | |
Manages capture, persistence, and restoration of game state for the current Unity scene. Feature overview.
Explicit entries – Save/restore individual variables declared in inspector.
[Saveable] attribute – Automatically pick up fields marked with [Saveable] Example: [Saveable] public int health = 100;
Serializable field dump – Persist every Unity-serialisable field on either all elements or subsection provided in inspector.
Save-slot system – Fixed or unlimited slot counts, with optional AES-256 encryption.
Typical workflow
Configure serialisation options in the inspector (or via script). Call to capture state and write it to disk. Call – or the slot-aware variants – to restore state at a later time.
All data are stored in Application.persistentDataPath. When encryption is enabled, files are written as plaintext first and then overwritten with the ciphertext.
| bool SaveManager.DeleteSaveFile | ( | string | id | ) |
Deletes a specific save file by its ID.
| id | Slot index or timestamp string to remove. |
true when the file existed and was deleted.| void SaveManager.DumpSavedDataToConsole | ( | ) |
Writes the current savedData contents to the Unity Console in a human-readable, column-aligned format.
Call this after RecordState() or LoadState() to inspect what was captured / restored.
| List< string > SaveManager.GetAllSaveFileIDs | ( | ) |
Returns all IDs currently present on disk that match SaveSlotName.
| void SaveManager.Load_SaveFileFromDisk | ( | int | saveSlot | ) |
Loads a save file corresponding to saveSlot or the newest timestamped file when unlimited slots are enabled.
| saveSlot | Slot index to load. |
| void SaveManager.LoadState | ( | ) |
Loads persisted state from disk and restores it into the current scene objects.
| void SaveManager.RecordState | ( | ) |
Captures game state using the enabled mechanisms and immediately commits it to disk.
| void SaveManager.Save_SaveFileToDisk | ( | int | saveSlot | ) |
Convenience wrapper that records state and saves it to the specified slot ID.
| saveSlot | Slot index to overwrite when EnableSaveSlots is enabled. Ignored when slots are unlimited (timestamp mode). |
| int SaveManager.AmountOfSaveSlots = 3 |
Maximum number of slots when EnableSaveSlots is true and .
| List<Component> SaveManager.ComponentListToSaveEveryThing = new List<Component>() |
Explicit set of MonoBehaviours whose fields will be saved/reloaded when SaveEverySingleComponentOrComponentInList is enabled.
| bool SaveManager.EnableFileEncryption = true |
Enables AES-256-CBC encryption during disk IO.
| bool SaveManager.EnableSaveSlots = false |
Enables numeric save slots (bounded by AmountOfSaveSlots).
| string SaveManager.encryptionPassword = "" |
48-character password; the first 32 chars form the AES key, the last 16 form the IV. Required 48 characters, nothing shorter or longer
| bool SaveManager.IncludeBuiltinComponentProperties = true |
| bool SaveManager.InfiniteSaveSlots = false |
Allows unlimited slot IDs by timestamping filenames instead of clamping to AmountOfSaveSlots.
| bool SaveManager.SaveAllSerializableFields = false |
Toggle that determines whether SaveAllSerializableFieldsFromList/… should dump all serialisable fields from the list or hierarchy search. (All components in-scene)
The list of variables that will be saved and restored when useSaveEntries is true.
| bool SaveManager.SaveEverySingleAttributeComponentOrComponentInList = true |
When enabled, only the components in serializableFieldComponents are inspected for [Saveable] fields. When disabled, every MonoBehaviour in the scene is scanned.
| bool SaveManager.SaveEverySingleComponentOrComponentInList = true |
When true, ComponentListToSaveEveryThing is used verbatim; when false, the component list is built automatically with Object.FindObjectsOfType<T>(bool). (Searching All components in-scene)
| string SaveManager.SaveSlotName = $"Saveata_%INEX%.json" |
Filename pattern used for all save operations. The token INDEX% is replaced with a slot ID or timestamp (depending on slot mode). Checks to ensure that .json is at the end and that only one . is present in file is done. Warning in editor or console error at awake.
| List<MonoBehaviour> SaveManager.serializableFieldComponents = new List<MonoBehaviour>() |
Manual list of components to scan for [Saveable] fields when SaveEverySingleAttributeComponentOrComponentInList is enabled.
| int SaveManager.SlotsToSaveTo = 1 |
Index used for the next save/load call when the UI selects a slot.
| bool SaveManager.useSaveableAttributes = true |
Enables scanning for fields decorated with [Saveable].
| bool SaveManager.useSaveEntries = true |
Master switch for SaveEntry-based serialisation.