editor
Drive the editor and its viewport: camera, Play-In-Editor, console, undo and redo, save, screenshots, input.
What it's for
This namespace drives the running editor application itself, not the assets inside it. It moves the viewport camera, switches view modes, starts and stops Play-In-Editor, runs console commands, undoes and redoes transactions, saves everything, opens assets and levels, and captures screenshots. If your assistant needs to do something in the editor UI rather than read or rewrite an asset on disk, it happens here.
Common uses: fly the camera to frame an actor and grab a screenshot for visual review; run a PIE
session and step it one frame at a time for deterministic debugging; toggle Game View or a wireframe
view mode before capturing; issue a Stat or r.* console command that has no
dedicated wrapper; save all dirty packages after a batch of edits.
The PIE controls are safe to script blind. editor.play, editor.stop,
editor.pause, editor.resume and editor.step_frame are all
idempotent guards that report state (for example alreadyPlaying or
NO_ACTIVE_SESSION) instead of failing destructively, so a script does not have to track
PIE state itself.
Two commands overlap with the system namespace and the split is deliberate:
editor.console_command runs against the editor world, so it is the right home for
Stat *, r.ScreenPercentage and viewmode tweaks, while
system.console_command runs at the broader process and engine scope. Use
editor for anything viewport-scoped.
Examples
Frame an actor and capture it for review
The assistant selects the actor, moves the camera to its bounds, then writes a PNG you can look at.
You: Point the camera at PlayerStart and take a screenshot.
call("editor.focus_actor", {actorName:"PlayerStart"})
→ {ok:true}
call("editor.screenshot", {filename:"player_start.png"})
→ {ok:true, path:"Saved/Screenshots/player_start.png"}
Done. Framed PlayerStart and saved player_start.png.
Step a Play-In-Editor session one frame at a time
Start PIE, advance a single frame for a deterministic look, then return to edit mode.
You: Play the level, step one frame, then stop.
call("editor.play", {})
→ {ok:true, alreadyPlaying:false}
call("editor.step_frame", {})
→ {ok:true}
call("editor.stop", {})
→ {ok:true, alreadyStopped:false}
Done. Ran one PIE frame and returned to edit mode.
Move the camera and switch the view mode
Teleport the viewport camera to a world-space transform, then render it unlit for a clean capture.
You: Put the camera at (500, 0, 300) looking down 20 degrees and switch to Unlit.
call("editor.set_camera", {location:{x:500, y:0, z:300}, rotation:{pitch:-20, yaw:0, roll:0}})
→ {ok:true}
call("editor.set_view_mode", {viewMode:"Unlit"})
→ {ok:true}
Done. Camera repositioned and viewport set to Unlit.