Unity Simple Game Saves

Save and load game data with PersistlyGameSaves.

Normal Unity integrations should use PersistlyGameSaves first. The raw runtime client remains available when you intentionally need the account/session contract.

Simple Game Saves

Use this as the default Unity integration pattern.

The slot is saved locally first. The first ForceSyncAsync, SyncDueSlotsAsync, or SyncDueAsync call creates the remote Persistly account and slot slot if needed.

C#
using Persistly.Unity;

await PersistlyGameSaves.ConfigureAsync(new PersistlyGameSavesSettings("ps_test_replace_me")
{
    PlayerRef = "player-184",
});

var saved = await PersistlyGameSaves.Shared.SaveDataAsync(new PlayerData
{
    Level = 5,
    Coins = 1200,
    Checkpoint = "forest-gate",
});

if (saved.Status == PersistlySlotStatus.LocalSaved)
{
    UnityEngine.Debug.Log("Saved locally. Call ForceSyncDataAsync or SyncDueAsync from a safe lifecycle moment.");
}

var loaded = await PersistlyGameSaves.Shared.LoadDataAsync<PlayerData>();
var sync = await PersistlyGameSaves.Shared.ForceSyncDataAsync();

Autosave

Use local-first saves, then sync at safe Unity lifecycle moments.

Call SaveDataAsync for one-save games when state changes, then ForceSyncDataAsync when the player pauses, reaches a checkpoint, completes a level, or exits. Use named slots when you need multiple slots or manual saves.

PersistlyGameSaves is the default Unity facade for normal game integrations.

SaveDataAsync and LoadDataAsync are the fastest one-save path; SaveSlotAsync and LoadSlotAsync remain the named-slot path for slots and manual saves.

The runtime client still exists for advanced account and slot integrations.

PersistlySlotStatus and PersistlySyncStatus are real enums; do not compare magic strings.

Conflict responses preserve the cloud slot branch and typed conflict details so Unity projects can reconcile intentionally.