14. Understand room-event order
In the normal room-entry path, the runtime marks the room visited, runs firstEnter if appropriate, then runs enter. It emits OnSceneLoaded afterward. The visible inspector lists enter first, but that is not the execution order for a first visit.
| Moment | Normal player room-change route |
|---|---|
| Leaving the old room | firstLeave if needed, then leave. |
| Beginning the load | OnSceneLeaving reports the old sceneId and nextSceneId. |
| Entering the new room | firstEnter if needed, then enter. |
| Entry lists are finished | OnSceneLoaded reports the new scene, previous scene and firstVisit. |
Figure 12. Use the first-entry list for the introduction or initial room objective.
This ordering matters when both a local list and a global listener change the same value. For example, set the objective locally, then let a global listener refresh a custom objective display from that value.
Save loading and other low-level loading routes can have different needs from a normal player exit. Do not use a local leave event as the only cleanup for every possible load, restart, teleport or interrupted sequence.
