UGTK cat mascotUGTKengine within an engine Request access

UGTK / Toolkit / Data Systems / Save System Completed

Data Systems — UGTK

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:

Ensure that this dependency is correctly imported and configured in your project.


Setup

  1. Add DataSaver prefab:

  1. (Optional) Add AutoSaveManager prefab:

  1. (Optional) Add SaveButton and/or LoadButton prefab:


How To Use

To use the Save System, configure the following scripts:

  1. Configuration of Mn_DataSaver:

  1. 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:

  1. Press Save, then look at File on disk: the full path, the size and the JSON itself.
  2. Change Directory Name and watch the path move. Empty means Assets/DataSaveFiles, DefaultPath means the platform's persistentDataPath - a different disk entirely on a device - and anything else means Assets/DataSave/<name>. Only the third one is inside the project, and only the second one survives an app update on a phone.
  3. Save some data, stop play, start again and load it.
  4. Load before anything has ever been saved.
  5. Corrupt the save file by hand and load it.
  6. 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:

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

Real dependenciesOpen in the map →

Measured from the repository: code references (asmdef) plus prefab and asset GUIDs. Importing this module alone brings in 2 modules in total.