Samples
The samples import from Package Manager → PersistKit → Samples → (pick one) → Import. Each one compiles against the package as it is, with nothing else to install.
01 Quick Start#
| File | What it shows |
|---|---|
QuickStartScore.cs | Saving and loading a number, with the default a new player gets, and a result checked |
QuickStartProfile.cs | Saving a data class, a list and a dictionary, and loading them back the next time the game runs |
README.md | What to press, in what order, and what you should see |
Drop both scripts on an empty GameObject in a new scene, press Play, then read the Console. Stop and press Play again: the values come back.
02 Automatic Saving#
| File | What it shows |
|---|---|
AutoSaveDemo.cs | A game that saves itself: the component on a timer, the game's own data saved through SaveNow() and Checkpoint(), and the result read back |
README.md | What to press, what to expect in the Console, and what the Inspector panel says while it runs |
Shows the one save path: automatic saves and asked-for saves go through the same call, so nothing is written twice.
03 Save Menu#
| File | What it shows |
|---|---|
SaveMenuDemo.cs | A finished save/load menu with no UI authored: several saved games, each with a picture, a timestamp, playtime, a chapter label and Save, Load and Delete — and Delete asks first |
README.md | How to open it, what a row shows, and how your own code answers SaveRequested and LoadRequested |
04 Offline Progress#
| File | What it shows |
|---|---|
OfflineProgressDemo.cs | An idle game working out how long the save was away: a cap on what a session is worth, a clock-rollback report, and the exact code for each way the time can look wrong |
README.md | How to run it twice with a pause in between, and how to change the clock policy |
05 Clicker: idle progression#
A complete scene, not a script to assemble: open Scenes/ClickerIdleProgress.unity and press Play.
| File | What it shows |
|---|---|
Scenes/ClickerIdleProgress.unity | The scene: the rock, the camera, the light, the panel and the five buttons, all wired |
Scripts/ClickerDemo.cs | A playable clicker: tap to mine, level up, save, and a welcome-back line that pays what was earned while the game was closed — with PersistKit's cap and the clock-rollback case stated rather than hidden |
Materials/Ore.mat | The rock's material |
README.md | What to press, how to see an offline payout, and why the award is capped |
06 Physics sandbox#
A complete scene: open Scenes/PhysicsSandbox.unity and press Play.
| File | What it shows |
|---|---|
Scenes/PhysicsSandbox.unity | The scene: floor, four walls, a starting stack of crates, the camera and the button bar |
Scripts/PhysicsSandboxDemo.cs | Crates spawned from a prefab, saved as a set, put back where physics left them — and retired when the player sweeps them away, so a later load does not rebuild them |
Prefabs/Crate.prefab | The crate that gets spawned. It carries a PersistKit Behaviour remembering its position and rotation, which is how a spawned crate remembers where it was |
Resources/PersistKit/ | The registry that names the prefab, shipped in a Resources folder, so there is nothing to wire |
Materials/ | The floor, wall and crate materials |
README.md | The order to press things in, and why Clear then Load is the interesting case |
07 Top-down RPG#
A complete scene: open Scenes/TopDownRpg.unity and press Play.
| File | What it shows |
|---|---|
Scenes/TopDownRpg.unity | The scene: ground, rocks, the player capsule, the two area markers and the button bar |
Scripts/TopDownRpgDemo.cs | A small top-down world with three save slots through the real runtime save menu: timestamp, playtime, the area it was saved in, and a thumbnail |
Materials/ | The ground, rock, player and marker materials |
README.md | Walk, save into a slot, load it again, and see that overwriting and deleting ask first |
What is not here yet#
Not supported There is no sample for cloud providers or for migrations: the cloud pages carry a copyable provider, and the migration page carries a worked example, because both need a service or an older build to be worth anything as a sample. Nothing on this page is a placeholder — every sample listed above imports, runs and has its save/load behaviour watched.
Writing your own first sample#
If you would rather build one yourself, the shortest path is the five-minute quick start, then the no-code guide for an object in a scene, and then cloud saves if you want a copy somewhere else.