# Loading order

> Aego 0.12.5 · development; docs build `4a32b816933e02930662f6a443cb25abe6050d090c55e237cbff5c44ae9b25f8`. [Build manifest](/docs-build.json).

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`.

1. The scene of the save is loaded fresh.
2. Scene nodes the save lists as destroyed are destroyed.
3. Spawned objects are spawned again with their persistent ids.
4. Transforms, component fields and `@persist` fields are restored.
5. Scripts run `Ready`, then `OnLoad`.

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.
