Skip to content

DevtoolsState

Defined in: packages/engine/src/stores/devtools.ts:225

Property Type Description
addBehaviour (id, name) => void Adds a registered behaviour’s trait with its defaults, and a row for it under the entity’s, which goes when the trait does.
behaviourOptions (id) => BehaviourOption[] The registered behaviours the entity has not got.
capture (view) => string | undefined A PNG data URL of the scene from a bookmarked camera, or undefined headless where no view is attached.
clearLog () => void -
deleteEntity (id) => void Destroys the entity; its component takes its row down.
describe (id, options?) => EntityDescription An entity’s row, its behaviours, the systems that touch it, its relations, its traits and a screenshot framed on it, by the row’s id, or else by its name where one entity row has it. Throws naming the ids where several do, and on an id that is no entity’s.
dump () => StateDump The bound world as JSON.
editing boolean Edit mode, which is when the recording runs.
focusCamera (id) => void Flies the orbit to the entity, at the distance that fits it, and stops the camera following until edit mode ends.
frameShot (camera, aspect) => MapView The camera a shot looks through on the mounted map: a raw view as written, or one framed round its subject from its angle, at the aspect given. With no map mounted, all frames what the scene draws. Throws on a subject the map has not got.
frameSplit FrameSplit | null The last 60 frames, written twice a second while frameTiming is on.
frameTiming boolean The loop times each frame into frameSplit; on while the overlay is mounted.
frameView (name) => MapView The camera for a name on the mounted map: a views entry, a region, a path, or map for the whole ground from above. Throws on a name the map has not got, and before a World has mounted.
freeCamera boolean The scene’s camera gives way to FreeCamera, and the hero stands still, as Unreal’s eject does.
hiddenIds string[] The rows whose entity hide took off the screen.
hide (id) => void Takes the entity off the screen; its physics and behaviours run on.
hover (id) => void -
hoveredId string | null The row under the pointer.
isLoading () => boolean Whether three’s loaders have a file in flight now, or a scene boundary has not drawn its content yet. The files are read from drei’s progress store, which the loading manager sets as a file starts, rather than the loading store the loop sets a frame later.
log LogLine[] The last two hundred lines the page’s console received, while captureLog is installed.
outline () => string The tree with the props left out: one row per line, indented under its parent, the entity id beside the name.
panels DevtoolsPanel[] -
pause () => void Does nothing on a room’s replica, which the room keeps running.
paused boolean Held still by the debugger; a modal’s pause is the modal stack’s.
pendingFrames number Fixed steps the loop still owes while paused: the period key.
readDisabledActions (id) => DisabledActions Why each of the actions below is off for the row, which is also what the action throws when called anyway.
readFrameSplit () => FrameSplit | null The last 60 frames as they stand, for a caller that cannot wait for frameSplit’s next write; none while nothing times them.
readPendingLoads () => PendingLoad[] Each file in flight and each scene boundary not yet drawn, with how long it has waited, so a wait that gives up can name it.
readProfile () => SystemTime[] The bound world’s step by system, as readStepProfile reads it; none while profiling is off.
readScene () => string | null The scene Game draws now, by its registered name; null before any.
recordedFrames number Frames in the recording, so a scrubber redraws as it grows. Ten seconds of simulated time, however many frames drew them.
registerPanel (panel) => Disposer The return forgets the panel.
resetProps (id) => void Drops the row’s edits and writes the component’s props back, to the room too where setProp sent it the edits.
resume () => void -
screenRects Record<string, ScreenRect> Where the hovered and the selected entity stand on the canvas, keyed by row id: the Frameloop’s, while editing.
seek (frame) => RecordedFrame | undefined The recorded frame frame back from the newest, where 0 is the oldest kept; the world stays where it is. Rewind is a later issue.
select (id) => void -
selectedId string | null -
setEditing (editing) => void Off drops the recording and gives the camera back the follow focusCamera stopped. The screen rects go either way: the loop writes them again while editing.
setFrameTiming (frameTiming) => void -
setFreeCamera (freeCamera) => void -
setProfiling (profiling) => void Times the bound world’s step by system from its next step, or stops timing it.
setProp (edit) => void Writes one prop of a behaviour row onto the trait whose schema has the field, and records it under the row’s edits until the component passes that trait a changed prop. A number is clamped to the row’s declared range for it. An edit of an entity a room streams goes to the room too, where it takes edits. Throws on a row that is no behaviour’s or is read-only, a name that is none of its props or no trait’s field, a function, a number that is not finite, and a value of another type than the prop’s.
setSpeed (speed) => void Does nothing on a room’s replica, as pause does: the hero’s moves follow the local steps, and the room applies them at its own rate.
show (id) => void -
speed number A multiplier on each frame’s time: 0.25, 1 or 2 on the top bar.
step (seconds) => void Advances the bound world by seconds of fixed steps on its last input, with no clock: an agent’s call, never a control in the overlay.
stepFrame () => void One fixed step, pausing a running world first. Does nothing on a room’s replica, as pause does.
stepUntil (options) => Promise<UntilResult> Pauses the world, then takes one fixed step at a time until the expression holds or the steps run out, leaving it paused on that step. The condition sees entities, count(trait), has(id, trait), player() and steps; one that throws counts as not yet. Whoever runs the world takes each step: the Frameloop in the browser, driveDevtools headless. Throws on a room’s replica, which cannot pause.
tree DevtoolsNode[] The scene as the developer wrote it: no invented groups.
walkTo (options) => Promise<WalkResult> Sends the hero walking to a point along the navmesh, as a click on the ground does, then steps as stepUntil does until the hero stands at the route’s end, which is as near the point as a route reaches. Throws where the point is off the navmesh.