UGTK / Toolkit / Data Systems / Save System Completed
Save System
Summary
The Save System is designed to save data from the game by storing key-value to be later on saved in the main memory.
Content
Modules Dependencies
The Save System module requires the following dependencies:
- Singleton Component: Module that manages a generic singleton pattern implementation for MonoBehaviour classes.
- DictionarySystem: Allow to serialize a dictionary.
Ensure that this dependency is correctly imported and configured in your project.
Setup
- Add
DataSaverprefab:
- (Optional) Add
AutoSaveManagerprefab:
- (Optional) Add
SaveButtonand/orLoadButtonprefab:
How To Use
To use the Save System, configure the following scripts:
- Configuration of
Mn_DataSaver:
- Configuration of
Mn_AutoSaveManager:
Testing Scene
Open SaveScene in the module's Debug/ folder and select DataSaver. Under the two
buttons the inspector prints where the file goes and what is in it, read from disk at every
repaint, so Save and Load are not silent any more.
What to do, in order:
- Press Save, then look at File on disk: the full path, the size and the JSON itself.
- Change Directory Name and watch the path move. Empty means
Assets/DataSaveFiles,DefaultPathmeans the platform'spersistentDataPath- a different disk entirely on a device - and anything else meansAssets/DataSave/<name>. Only the third one is inside the project, and only the second one survives an app update on a phone. - Save some data, stop play, start again and load it.
- Load before anything has ever been saved.
- Corrupt the save file by hand and load it.
- Add a field to the saved type and load an old file.
Steps 4 to 6 are the three ways a save system meets reality: the first run, a file damaged by a crash or a half-finished write, and a build newer than the file it is reading. Each has to end in a playable game rather than an exception — a save system that throws on load has locked the player out of their own progress.
Technical Info
The following are the main scripts and their functionalities:
Scripts:
- DataType: Used to distinguish between MonoBehaviours and ScriptableObjects.
- IAutoSaveObject: Allow to be included in
Mn_AutoSaveManager. - Mn_AutoSaveManager: Make each time automatic save after certain amount of time.
- Mn_DataSaver: Collect, save and load data to be save and later loaded. Its inspector picks the field to save from a dropdown of the target's real fields (no typing).
- SaveSystem: Effective implementation that allow to store data in main memory. Includes a
non-generic
Save(object, Type, fileName, directory)for reflection-driven tools.
Save Data Viewer (UGTK → Save Data Viewer) — wizard editor window in three steps:
1. Source: drag anything (GameObject → pick the MonoBehaviour from a dropdown, or a component /
ScriptableObject directly; "Use selection" grabs the current selection).
2. Field: pick the field from a dropdown, with a read-only live value preview.
3. File: location dropdown (project folder / device persistent / custom subfolder — no magic
strings), file name, clickable list of existing save files, "Open folder".
Actions: Save → file, Load → field, ✨ Create file with DEFAULT data (a clean starting
save generated from the field's type), inline JSON editing with save/revert/delete, and a coloured
status bar reporting every outcome.
© 2026 Marcello De Bonis. All rights reserved
Depends on 2
Used by 2
Measured from the repository: code references (asmdef) plus prefab and asset GUIDs. Importing this module alone brings in 2 modules in total.
UGTKengine within an engine

