Persistence¶
Tunal persistence captures selected simulation/configuration state and restores it to an existing configured scene. It is not a general save system for arbitrary Unity GameObjects, scene creation, inventory, or every material setting.
Use TunalPersistence for one context and WorldPersistence to coordinate several registered contexts. Both require explicit save/load actions; adding the component does not start autosaving despite the default local slot being named autosave.
Choose a workflow¶
| Need | Guide |
|---|---|
| Store a snapshot in memory or your own backend | Capture and restore |
| Save selected context state to local JSON | Single-context setup |
| Save all participating contexts as one world slot | World persistence |
| Resolve authored profile references across builds | Catalogs and identifiers |
| Save scene lifecycle instance progression | Lifecycle registration |
| Understand local files, browser sync, and errors | Storage and restoration contracts |
Common prerequisites¶
Initialize the context and its Time System before capture/restore. Assign a stable Context ID. Select the state you need and provide a Profile Catalog for any saved profile references. For detached presentations, set the correct scope rather than allowing another context's controllers to be captured accidentally.
PersistenceResult has success, error, and warnings. A success with warnings can mean some optional sections were unavailable and omitted/skipped. Always display/log warnings as well as failures. A failed load must not be reported as “nothing changed”: preflight reduces risk, but runtime application can fail after mutation begins.
Snapshots are portable data, not Unity object references. Derived celestial values are recomputed from authoritative time/configuration. Saving a profile ID does not embed its authored contents, and saving one context does not automatically save every world in the scene.
Read the restoration contract before depending on event order or implementing a custom backend. There is no blanket atomic-restore or durable-browser-storage guarantee.