Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit3bb1da2647

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

ModuleResponsibility
loader.moduleReads scene.json v6 and v7, refuses versions it does not know, composes canonical + dirty overlay, spawns the entities, and runs the entrypoint.
saver.modulePersists scene state as a delta overlay against the canonical file, promotes that overlay on save, and answers which edits are still pending.
build.moduleRuns a build.luau inside an entity capture scope and composes what it spawned into scene records.
observe.moduleThe read side — the per-scene counts and costs layers and loader write.
swapOrchestrator.moduleDrives 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.