Generated code

The code the Inspector offers for your configuration, what it uses, and the framework internals it deliberately never mentions.

Editor NexusForge Persistence 0.2.0 Updated

Where it comes from#

The Inspector's Code section generates a snippet from your configuration — the real slot, the real schema version — using public APIs only. Because it is generated from the settings asset rather than typed by hand, pasted code and configuration cannot quietly disagree. The Samples & code page of the settings window does the same, and lists the four importable samples and the documentation in reading order.

Two depths, matching the Inspector modes#

  • Beginner shows the simple API: ``csharp await NexusForgePersistence.Save("player", playerData); var loaded = await NexusForgePersistence.Load<PlayerData>("player"); ``
  • Advanced shows the capture → save → recover flow the component performs, with the explicit service calls.

What generated code never mentions#

The envelope, compression, encryption, integrity, storage and migration types. Those are the framework's business, not the game's: a snippet that made a game responsible for a container's internals would be teaching the wrong thing. It also never emits anything the validation panel flagged as unsupported.

Where the runnable versions live#

Four samples, importable from Package Manager → NexusForge Persistence → Samples:

SampleShows
01_BasicSaveLoadSave, load, autosave, flush on pause
02_CloudSyncProvider, offline queue, preserved conflict
03_MigrationAndVersioningSchema 1 → 2, unknown members preserved
04_PersistentObjectsAndCheckpointsStable ids, rotating checkpoints

Each has its own assembly definition, so it compiles cleanly in a project of any size and can be deleted without leaving dangling references.

Next#

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 · Frequently asked questions · Troubleshooting