Give each value a name
A key is a name for saved data. Use names that explain the value, such as player.coins or level.completed.
SaveSystem.Set("player.coins", 250);
SaveSystem.Set("level.completed", true);
SaveResult result = await SaveSystem.SaveAsync();
Set updates memory. SaveAsync writes it to storage. Use await when you need to know that saving has finished.
Load before reading
SaveResult result = await SaveSystem.LoadAsync();
if (result.Succeeded || result.Status == SaveStatus.Missing)
{
int coins = SaveSystem.Get("player.coins", 0);
}
The second argument to Get is the default value. Here, a new player starts with zero coins. See the quick start for a complete script.
Check whether it worked
SaveResult result = await SaveSystem.SaveAsync();
if (!result.Succeeded)
UnityEngine.Debug.LogError(result.Message);
Only show a “Saved” message after the operation finishes successfully.
| Result | What to do |
|---|---|
| Success / Unchanged | The operation succeeded. Unchanged means no new write was needed. |
| Missing | No save exists yet. This is normal for a new game. |
| Corrupt / IncompatibleVersion | Keep the file and check recovery or migration options. |
| Other failure | Read the message. It may report configuration, storage, cancellation, or conflict problems. |
Choose a save moment
Save at checkpoints, from a button, at intervals, or when the application pauses. Capture gameplay values before saving them.
Do not depend on a final save when the game closes: mobile apps and browser tabs can close before it finishes.
Find or remove a value
if (SaveSystem.TryGet<int>("player.coins", out int coins))
UnityEngine.Debug.Log(coins);
SaveSystem.Remove("old.key");
await SaveSystem.SaveAsync();
Use GetKeys() to list the current profile's keys. Removing a key changes memory; save afterward to keep the removal.
Advanced options
Cancellation and changes made during saving
using var cancellation = new System.Threading.CancellationTokenSource();
SaveResult result = await SaveSystem.SaveAsync(cancellation.Token);
Cancellation before a file is committed leaves it unchanged. A completed write cannot be undone by cancellation. Changes made while saving remain marked for the next save.
Call the API from Unity's main thread. EnsureLoadedAsync() coordinates one initial load when several startup scripts need it.
Existing Save/Load calls and completion events
Save() and Load() still work. In asynchronous mode, their return does not mean the operation is finished; use completion events or awaitable methods.
private void OnEnable() => SaveSystem.OnSaveEndEvent += Saved;
private void OnDisable() => SaveSystem.OnSaveEndEvent -= Saved;
private void Saved(bool success) => UnityEngine.Debug.Log("Saved: " + success);