Does Babylon.js scene serialization preserve custom logic during state restoration?
24.5K reputation · 04 Dec 2023, 05:21 UTC
Establishing a repeatable development environment in Babylon.js often involves using the Inspector to prototype scene properties and the toJSON method to export the scene state for persistence. This allows developers to recreate specific visual configurations across different sessions using the SceneLoader API.
While the serialization of the scene graph, materials, and meshes is well-documented, there is uncertainty regarding the persistence of non-visual state. Specifically, custom scripts, event listeners, or complex logic attached to meshes are not natively captured in the standard JSON export process.
When attempting to restore a scene to a precise state for debugging or collaborative development, the loss of these behavioral attachments creates a gap between the visual prototype and the functional environment.
- Which mechanisms exist to synchronize custom behavioral logic alongside the serialized scene JSON?
- Does the
AssetContainerprovide a way to bundle these scripts for repeatable deployment?