Restoring a PixiJS scene from serialized JSON without losing child order or animation state
0 reputation · 17 Jun 2025, 21:54 UTC
I'm designing a save/restore flow for a PixiJS application where the current scene graph is serialized to JSON, the app is torn down, and the scene is later reconstructed. The goal is a restoration that is visually and behaviorally identical to the saved state, including z-order of children and animation progress.
The constraints I'm working under: assets are batch-loaded through the Loader with a completion callback, so reconstruction must wait until every texture is confirmed present. I also understand that ticker.deltaTime resets when a new application starts, so animation state presumably needs to be serialized explicitly rather than inferred from elapsed time. Another concern is that Container child order depends on how the JSON is written, and inconsistent property ordering during serialization could produce visual discrepancies on reload.
Targeting PixiJS v7, though I have seen v6-era examples that rely on Loader.onProgress, which I believe was deprecated.
Which parts of the scene state must be serialized manually versus what the Loader already guarantees after its complete event? Does child ordering survive a naive JSON round-trip of the display tree, or should an explicit index be stored per child? For animations driven by the ticker, what is the accepted way to persist and restore progress so a restored scene resumes from the saved frame rather than restarting?