Loading order
Loading a save rebuilds the game in a fixed order. Knowing the order tells you which values a script already has in Ready and OnLoad.
- The scene of the save is loaded fresh.
- Scene nodes the save lists as destroyed are destroyed.
- Spawned objects are spawned again with their persistent ids.
- Transforms, component fields and
@persistfields are restored. - Scripts run
Ready, thenOnLoad.
Fields restored in step 4 are already set when Ready runs. A field that is not marked comes from the scene, as on a fresh start.
References between saved nodes survive: a NodeRef to a scene node is saved by its id, a reference into a spawned object by the object's persistent id and the path inside it.