Builtin Library
README.md
BakedLighting
Keeps the scene's baked lighting in step with the scene. Watches the
engine's authored-change feed and reacts the moment an edit reaches the
bake: the artifacts that described the old scene are dropped, the
withheld lights come back, and (with autoBake on) the scene re-bakes
itself once the edits settle.
The bake attaches this automatically — a scene that has been baked is a scene that maintains its bake.
Fields
| Field | Default | Purpose |
|---|---|---|
autoBake | true | Re-bake once the edits settle. |
settleSeconds | 1.5 | Quiet time after the last edit before re-baking. |
resolution | 0 | Lightmap resolution for the re-bake; 0 uses the bake's default. |
samples | 0 | Sample count for the re-bake; 0 uses the bake's default. |
With autoBake off the stale bake is still dropped — the scene shows
honest realtime light rather than a stale photograph — and re-baking
becomes an explicit baking.all.
When a re-bake fails
A re-bake that fails (the device was lost, a dispatch was refused, an option
the bake cannot honour) leaves the scene on realtime light and holds automatic
re-baking: further edits still invalidate the bake but start no new one, and a
bake.autobake_held notice names the failure. The hold is session state of the
machine whose bake failed. An explicit bake (baking.all, baking.lightmaps, baking.probes)
that succeeds clears it and the maintainer resumes. Re-baking on the next edit
would repeat, within seconds, the bake that just failed.
Cost
Nothing until something is baked, and nothing at all in play mode. Authored edits are an edit-mode concern and static geometry does not move at runtime, so the engine's change feed is inert while the game runs.
Dragging a wall across the room drops the bake once, on the first frame
of the drag, and re-bakes once after settleSeconds of quiet — not once
per frame.
Usage
-- opt out of automatic re-baking, keep automatic invalidation
entity.find("scene").component.add("BakedLighting", { autoBake = false })