Shank Game Tools - Save System
Lightweight and flexible save system for Unity that simplifies game data persistence with a modular, extensible architecture. Features simple save/load/delete methods, full Unity Test Framework integration, and adaptable strategies for different project needs. Easy integration through a clean API using serializable data transfer objects and the ISaveable interface.
com.shank.gametools.savesystem 
Install via UPM
Add to Unity Package Manager using this URL
https://www.pkglnk.dev/juanpablomaggi-savesystem.git README Markdown
Copy this to your project's README.md
## Installation
Add **Shank Game Tools - Save System** to your Unity project via Package Manager:
1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/juanpablomaggi-savesystem.git
```
[](https://www.pkglnk.dev/pkg/juanpablomaggi-savesystem)README
GameTools-UnitySaveSystem
A lightweight and flexible save system for Unity, designed to be easy to integrate and adaptable to different project needs.
Features
- Simple and modular architecture.
- Methods to save, load, and delete game data.
- Fully integrated with the Unity Test Framework.
- Flexible design for different save/load strategies.
Getting Started
Installation
On Unity's Package Manager, click on the + button and add a new package from git URL. Then add the URL https://github.com/juanpablomaggi/GameTools-UnitySaveSystem.git#1.0.2
Let the package import automatically.
Usage
- Define a DTO class for the data you want to save
[!IMPORTANT] Remember to make the class serializable.
[System.Serializable]
public class SavedPlayerData
{
public int Health { get; set; } = 100;
public string Name { get; set; } = "SavedPlayer";
}
- Implement ISaveable in your object, using the DTO class as type:
public class Player : ISaveable<SavedPlayerData>
{
public string SaveKey => "SavedPlayer";
public string Name { get; set; }
public int Health { get; set; }
public SavedPlayerData CaptureState()
{
return new SavedPlayerData { Name = Name, Health = Health };
}
public void RestoreState(SavedPlayerData state)
{
Name = state.Name;
Health = state.Health;
}
}
- Initialize the SaveService and register your saveable objects. When you save the game, it will capture the current state of the object to save.
public class GameManager : MonoBehaviour
{
[SerializeField] private Player player;
private ISaveService saveService;
private void Awake()
{
saveService = new SaveService();
saveService.Init();
}
private void Start()
{
saveService.Register(player);
player.Name = "Player1";
saveService.SaveGame();
}
}
- Load the game by calling LoadGame on the service:
public void LoadGame()
{
saveService.LoadGame();
}
[!TIP] If an ISaveable object is registered after loading, the system will immediately inject the previously saved data.
Changelog
Changelog for this project. Latest release 1.0.2
Future Plans
- Create a IStorage interface to abstract the storage mechanism (Currently only Binary serialization).
- Create a tool for save preferences management.
No comments yet. Be the first!