Skip to content

AnchorSave is an easy, extensive JSON-based saving system for Unity.

License

Notifications You must be signed in to change notification settings

Fonity/AnchorSave

 
 

Repository files navigation

AnchorSave

AnchorSave is a lightweight, JSON-based save system for Unity.

It is designed to be simple, explicit, and safe, without using deprecated APIs like BinaryFormatter, reflection-heavy magic, or opaque serialization pipelines.

If you want full control over what gets saved — and the ability to inspect and debug save files — AnchorSave is built for that.


Features

  • Explicit save/load via ISaveable
  • Human-readable JSON save files
  • Slot-based saving support
  • Works in builds and in the Editor
  • No BinaryFormatter
  • No reflection-based auto-serialization
  • Demo scene included

Documentation

Full documentation: Documentation


How It Works

AnchorSave follows a simple rule:

Only objects that implement ISaveable are saved.

Each saveable object:

  • Provides a stable UID
  • Returns a plain serializable data structure
  • Restores itself from JSON during load

The save system:

  • Iterates over all active ISaveable components
  • Stores their data as JSON, keyed by UID
  • Restores state by matching UIDs on load

There is no automatic scene scanning, guessing, or hidden behavior.


Example

public class Player : MonoBehaviour, ISaveable
{
    public string UID => "Player";

    public object CaptureState()
    {
        return new PlayerSaveData
        {
            position = new float[]
            {
                transform.position.x,
                transform.position.y,
                transform.position.z
            }
        };
    }

    public void RestoreState(object state)
    {
        PlayerSaveData data =
            JsonUtility.FromJson<PlayerSaveData>((string)state);

        transform.position = new Vector3(
            data.position[0],
            data.position[1],
            data.position[2]
        );
    }
}

About

AnchorSave is an easy, extensive JSON-based saving system for Unity.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%