Skip to content

feat: add stable IDs and save participants - #15

Merged
pes7 merged 28 commits into
masterfrom
refactor/stable-ids-save-participants
Jul 27, 2026
Merged

pes7 merged 28 commits into
masterfrom
refactor/stable-ids-save-participants

Conversation

@pes7

@pes7 pes7 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

This stacked PR extends save/load with stable object IDs and participant-based mutable world persistence on top of refactor/save-load-persistent-state.

Completed scope

  • upgrades save schema to version 3
  • stores persistent world objects and tombstones
  • adds PersistentIdentity for authored and runtime-spawned logical objects
  • adds IPersistentSaveParticipant with stable participant keys and payload versions
  • adds deterministic PersistentWorldState capture/restore
  • adds explicit tombstone semantics without relying on OnDestroy
  • adds PersistentPrefabCatalog for recreating runtime-spawned objects
  • integrates world capture, runtime recreation and restore into SaveGameCoordinator
  • adds TransformSaveParticipant
  • adds HealthSaveParticipant
  • adds Editor commands to assign missing scene IDs and validate IDs
  • validates duplicate object IDs, missing IDs, runtime prefab IDs and duplicate participant keys
  • blocks builds when loaded scenes contain invalid persistent IDs
  • adds EditMode tests for capture, restore, tombstones, schema migration and duplicate suppression
  • adds Docs/STABLE_IDS_SAVE_PARTICIPANTS.md

Stacking

Base branch: refactor/save-load-persistent-state

Merge after PR #14, or retarget after earlier stacked PRs are merged.

Unity workflow

  1. Add PersistentIdentity to mutable scene objects.
  2. Add TransformSaveParticipant, HealthSaveParticipant or domain-specific participants.
  3. Run Zone UA -> Persistence -> Assign Missing Stable IDs.
  4. Review and save scene changes.
  5. Run Zone UA -> Persistence -> Validate Stable IDs.
  6. Create Zone UA/Persistence/Persistent Prefab Catalog.
  7. Register runtime dropped-item/building/NPC prefabs with stable prefab IDs.
  8. Assign the catalog and optional runtime root to SaveGameCoordinator.

Validation required in Unity 6000.5.5f1

  • project compiles with zero Console errors
  • all PersistentWorldStateTests pass
  • missing and duplicate scene IDs are reported
  • duplicate participant keys are reported
  • destroyed authored objects remain absent after save/load
  • runtime-spawned objects are recreated exactly once from the prefab catalog
  • transform and health payloads restore correctly
  • scene unloading and application shutdown do not create tombstones
  • missing prefab catalog entries produce warnings without aborting the remaining restore
  • production scenes and prefabs are migrated and saved through Unity Editor

The code and tooling scope is complete. This PR remains draft because Unity compilation, scene serialization, prefab catalog references and Play Mode world-state restoration must be validated locally.

@pes7
pes7 force-pushed the refactor/save-load-persistent-state branch from 5c049cd to cf82e67 Compare July 27, 2026 21:14
pes7 added 28 commits July 27, 2026 23:15
@pes7
pes7 force-pushed the refactor/stable-ids-save-participants branch from f4f23d8 to ec7e96f Compare July 27, 2026 21:16
@pes7
pes7 changed the base branch from refactor/save-load-persistent-state to master July 27, 2026 21:16
@pes7
pes7 marked this pull request as ready for review July 27, 2026 21:16
@pes7
pes7 merged commit c39c5a8 into master Jul 27, 2026
2 checks passed
@pes7
pes7 deleted the refactor/stable-ids-save-participants branch July 28, 2026 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant