PersistenceEditor
Reads and rewrites persisted records for the dashboard's Persistence tab (/persistence).
Nebula · Packages/com.1by3.nebula/Runtime/Orchestrator/PersistenceEditor.cspublic sealed class PersistenceEditorReads and rewrites persisted records for the dashboard's Persistence tab (/persistence).
The standalone orchestrator reads field schemas exported from game prefabs and scene entities at build time. Fields use the same names as PersistentStateCodec ("<BehaviourTypeName>.<FieldName>"). Built-in types and exported enumerations have typed controls. Custom types, unknown fields, and a behavior's own #state chunk are shown and edited as hex.
Loads are asynchronous (the store answers from IPersistenceStore.Tick), so the editor keeps a snapshot of every record and refreshes it at most every SnapshotMaxAgeSeconds seconds while the page polls. Every method here must run on the main thread, from the orchestrator's command pump.
Caveat. An edit lands in the store, not in a running worker. While an entity is alive and authoritative somewhere, its next checkpoint overwrites whatever you saved here. Edit records of entities that are not alive (the mesh is stopped, or the entity was deleted), or fields the entity never writes back.
Constructors
PersistenceEditor
public PersistenceEditor(IPersistenceStore store);Fields
SnapshotMaxAgeSeconds
public const float SnapshotMaxAgeSeconds = 2f;How long a snapshot of the store is served before the next GET triggers a reload.
EditorSavedBy
public const string EditorSavedBy = "dashboard";Written into PersistedEntityRecord.SavedBy so an edit is never mistaken for a live worker's save.
Properties
Store
public IPersistenceStore Store { get; }The store this editor was built for, so the orchestrator can notice the store being swapped.
Methods
Records
public OrchestratorHttpServer.Response Records();GET /api/persistence/records: every record, decoded.
Update
public OrchestratorHttpServer.Response Update(string body);POST /api/persistence/record: apply an edit and save it under the record's current epoch. Body: {key, position?, rotationEuler?|rotation?, velocity?, containerId?, carrierKey?, name?, entries?}.
Delete
public OrchestratorHttpServer.Response Delete(string body);POST /api/persistence/delete: {key}.
Duplicate
public OrchestratorHttpServer.Response Duplicate(string body);POST /api/persistence/duplicate: {key, newKey, ...}. Copies the record under a new key, optionally with the same edits Update accepts (a second crate three meters to the left).
Refresh
public void Refresh(bool force);Reload the snapshot when it is older than SnapshotMaxAgeSeconds (or always, when force). Both stores answer a load from memory through their callback queue, so one IPersistenceStore.Tick hands the result back inside this call whenever the store is ready.
ToHex
public static string ToHex(byte[] bytes);TryFromHex
public static bool TryFromHex(string hex, out byte[] bytes);