Samples
The four samples import from Package Manager → NexusForge Persistence → Samples. Each has its own assembly definition, so it compiles cleanly in a project of any size and can be deleted without leaving dangling references.
| Sample | Shows | Assembly references it needs |
|---|---|---|
01_BasicSaveLoad | Save, load, autosave and flush on pause | Core, Unity, Serializers.Newtonsoft |
02_CloudSync | A provider, an offline queue and a preserved conflict | Core, Unity, Serializers.Newtonsoft |
03_MigrationAndVersioning | Schema 1 → 2 through a registered migration, unknown members preserved | Core, Unity, Serializers.Newtonsoft |
04_PersistentObjectsAndCheckpoints | Stable identities and rotating recovery points | Core, Unity, Serializers.Newtonsoft |
01 — Basic save and load#
The shortest useful example: a model, a component that saves it on disable and on pause, autosave with a debounce, and a checkpoint the player can fall back to. Start here; everything else builds on it.
- 5-minute quick start — the same path, in text.
- No-code save component — the component this sample uses.
02 — Cloud synchronisation#
A full sync against the in-memory FakeCloudTransport: upload, download, an offline queue that survives a restart, and a conflict that is preserved rather than resolved silently. It is the clearest way to see what the framework does above your transport, and what it expects your transport to do.
- Cloud architecture — the boundary.
- Conflict resolution — the policy that produced the preserved copy.
03 — Migration and versioning#
Writes a schema 1 save, then loads it as schema 2 through a registered migration, and shows an unknown member surviving the round trip intact. The migration is code, registered at initialisation, exactly as a shipping project would do it.
- Migration — the checklist this sample follows.
- Schema versions — which number changes and when.
04 — Persistent objects and checkpoints#
Objects that must survive a scene edit, with persistent identities and the identity scan that finds missing or duplicate ids; plus rotating checkpoints that a player can return to. It is the sample to read before making a world that can be re-entered.
- Persistent IDs — the identity model.
- Checkpoints — rotation that never costs the player the previous point.
Running them safely#
Each sample folder contains its own README.md describing what it demonstrates, what to press and what to expect, and the code is documented in place. Samples are compiled as part of the package's own verification, so one cannot rot unnoticed.
Next#
- Generated code — the snippet the Editor produces for your configuration.
- Installation — importing and referencing assemblies.
- Documentation — the full set of topics.