Runtime save menu

A finished save and load menu for a Unity game, built at runtime from a single component — slots, pictures, playtime, labels and confirmation before deleting.

PersistKit NexusForge Persistence 1.0.0 Updated

What it is#

PersistKit Save Menu is a save and load menu a game can ship with: a line per saved game showing its picture, the date, how long it has been played, its label and its size, with Save, Load and Delete beside it. There is nothing to lay out — the component builds its own canvas, its own rows and its own confirmation when the game runs.

Available In the package and covered by tests in the Editor and at runtime.

csharp
class="tok-com">// Put this on a pause-menu button and the menu is reachable.
public void OnPauseButton() => menu.Toggle();

Opening and closing#

Open(), Close() and Toggle() are the whole public surface for showing it. Tick Show On Start to have the menu open with the scene, which is handy while you are building the game.

What happens when a player saves or loads#

The menu does not rebuild your scene. It raises the event and your game answers:

EventRaised whenWhat to put in it
Opened / ClosedThe menu is shown or hiddenPausing, music, cursor handling
SaveRequestedA player saves into a slot (the slot id is passed)Your own data for that slot
LoadRequestedA player loads a slotThe code that puts your scene back
SlotDeletedA slot was deleted after confirmationAnything that refers to that slot

Every one of those also runs through the component's Inspector fields, so a first menu needs no code at all.

What it will not do#

  • It will not load half a save. A slot whose data cannot be read is refused, with the code for what was wrong, rather than loading part of it and leaving the game in between two states.
  • It will not delete on one click. Deleting asks first; HasPendingQuestion says a question is on screen, and AnswerPendingQuestion(true) answers it — so a mis-tap is never a lost save.
  • It will not invent a slot's details. Date, playtime, label and size come from what was actually written. A save written by an older build simply has no picture or label, and the row says so instead of showing an empty box.

The one scene dependency#

Buttons need an Event System. If the scene has none, the menu says so in the Console instead of failing quietly; tick Create Event System If Missing and it will make one, or add one yourself with *GameObject ▸ UI ▸ Event System*. If your project uses the Input System package, put its input module on that object.

Selecting the component shows this check, and the rest of the setup, read back in plain words — so the answer to "why can I not click anything?" is in the Inspector before you run the game.

Keeping the pictures#

Each save writes a small picture of the screen (320 pixels wide by default) and a note of its details beside the save file, never inside it. Deleting a save removes both; a save written by a build that did not write notes still loads, it just has less to show. See slots, metadata and backups.

Something wrong on this page? Every page here describes behaviour that is checked in the repository. If a page and the package disagree, the package wins.

Report a documentation problem · Error codes · Platforms and limitations