What can I save?
Save the values your game needs to remember: coins, positions, inventory items, and similar data. Use the same type when saving and reading a key.
| What you want to save | How to save it |
|---|---|
| Numbers, text, booleans, enums | Use Set and Get directly. |
| Arrays, lists, dictionaries, queues, stacks, hash sets | Supported when their contents are supported. String dictionary keys are the simplest choice. |
| Vector2, Vector3, Vector4, Quaternion, Color | Use them directly; converters are included. |
| Your own classes and structs | Store data fields, as shown below. |
| Transform and other component values | Use Inspector bindings to restore an existing object. |
| GameObjects, prefabs, and asset references | Save their IDs and values. Your game must find or create the objects. |
Save a custom class
Keep the class focused on values rather than references to scene objects:
[System.Serializable]
public sealed class PlayerState
{
public int coins;
public UnityEngine.Vector3 position;
}
Register the type before loading, then use it with Set and Get:
SaveTypeRegistry.Register<PlayerState>("game.player.v1");
SaveSystem.Set("player", new PlayerState { coins = 20 });
// Call SaveAsync to write it to a file.
Which private fields are included?
For data classes, the default serializer follows Newtonsoft JSON rules. Use public data members, Newtonsoft attributes, or a converter. Unity's [SerializeField] alone does not include every nested private field.
Inspector Field bindings and [StorageSync] read their selected fields directly. That does not change how nested data classes are serialized.
Remember component state
Inspector bindings support Transform/RectTransform, active/enabled state, Rigidbody/Rigidbody2D, and selected mutable fields. Follow Save without code to set these up.
Advanced: Transform calls and collection support
Load(key, target) can apply a saved Transform snapshot to an existing Transform. It does not create a new object.
Multidimensional arrays are supported. Stacks use a dedicated converter to preserve their order. Custom collections still need serializable contents.
Remember objects by ID
For example, save an inventory item's ID and quantity rather than its prefab reference. When loading, look up that ID in your game's item list.
The plugin does not rebuild entire scenes, spawn saved prefabs, or restore arbitrary Unity object references. Screenshot previews have their own APIs; they do not provide general Texture2D serialization.
Check custom types in a player build
Test on your target platform, especially with IL2CPP. A type that works in the Editor may need preservation settings in a build.
Advanced: IL2CPP preservation
Binding validation generates preservation for Inspector-selected types and fields. For your own data classes and converters, preserve reflected members with linker settings and explicitly use the required generic types.
Registering a type ID helps resolve the type; it does not guarantee every reflected member survives code stripping. Verify a player with stripping enabled.