Builtin Library
README.md
scene runtime
What a .scene folder does when it is loaded, saved, built, or swapped.
A <name>.scene/ carries scene.json (the entity arrangement), an optional
build.luau (the code author's half), an optional entrypoint.luau, and a
scene_dirty/ overlay of unsaved edits. Reading, composing and writing all
four is the scene type's own behaviour, so it lives in the type.
Sub-modules
| Module | Responsibility |
|---|---|
loader.module | Reads scene.json v6 and v7, refuses versions it does not know, composes canonical + dirty overlay, spawns the entities, and runs the entrypoint. |
saver.module | Persists scene state as a delta overlay against the canonical file, promotes that overlay on save, and answers which edits are still pending. |
build.module | Runs a build.luau inside an entity capture scope and composes what it spawned into scene records. |
observe.module | The read side — the per-scene counts and costs layers and loader write. |
swapOrchestrator.module | Drives multiplayer room transitions and the scene-swap gate, so a local swap does not leak despawns to peers in the old room. |
Reaching it
local rt = require("@builtin::assetTypes.scene.shared")
rt.saver.hasPendingSceneEdits(layers.active.name)
Fields resolve lazily. The prelude installs swapOrchestrator and starts
saver's dirty writer in a fixed order, which a table that required all five
on load would take away from it.