editor.state

Editor state queries and actions (selection, world info, viewport, undo/redo)

← API Reference

editor.state.getSelection

Returns the currently selected actors in the level editor.

No parameters.

Returns

Array of objects:

Field Type Description
namestringActor display label
classstringActor class name
pathstringFull object path

Example Request

{ "jsonrpc": "2.0", "id": 1, "method": "editor.state.getSelection" }

Example Response

{
  "jsonrpc": "2.0", "id": 1,
  "result": [
    { "name": "Cube", "class": "StaticMeshActor", "path": "/Game/Maps/MyLevel.MyLevel:PersistentLevel.Cube" }
  ]
}

editor.state.getOpenEditors

Returns all currently open asset editors.

No parameters.

Returns

Array of objects:

Field Type Description
namestringAsset name
typestringAsset class name
asset_pathstringFull asset path

Example Request

{ "jsonrpc": "2.0", "id": 1, "method": "editor.state.getOpenEditors" }

editor.state.getWorldInfo

Returns information about the current editor world.

No parameters.

Returns

Field Type Description
level_namestringCurrent map name
sub_levelsarrayStreaming sub-levels (each with name, is_loaded)
play_statestring"stopped", "playing", or "simulating"

Example Request

{ "jsonrpc": "2.0", "id": 1, "method": "editor.state.getWorldInfo" }

Example Response

{
  "jsonrpc": "2.0", "id": 1,
  "result": { "level_name": "Lvl_FirstPerson", "sub_levels": [], "play_state": "stopped" }
}

editor.state.getViewportState

Returns the active viewport's camera state.

No parameters.

Returns

Field Type Description
positionobject{x, y, z} camera location
rotationobject{pitch, yaw, roll} camera rotation
view_mode_indexnumberNumeric view mode index
view_modestringHuman-readable view mode name
is_realtimeboolWhether viewport is in realtime mode
is_perspectiveboolWhether camera is perspective (vs orthographic)

Example Request

{ "jsonrpc": "2.0", "id": 1, "method": "editor.state.getViewportState" }

editor.state.getUndoStack

Returns the most recent undo history entries (up to 20).

No parameters.

Returns

Array of objects:

Field Type Description
titlestringTransaction description
indexnumberPosition in undo queue
is_undoneboolWhether this entry has been undone

Example Request

{ "jsonrpc": "2.0", "id": 1, "method": "editor.state.getUndoStack" }

editor.state.getPlayState

Returns detailed PIE (Play-in-Editor) state information.

No parameters.

Returns

Field Type Description
play_statestring"stopped", "playing", or "simulating"
is_playingboolWhether a PIE session is active
is_simulatingboolWhether simulating in editor

Example Request

{ "jsonrpc": "2.0", "id": 1, "method": "editor.state.getPlayState" }

editor.state.getProjectInfo

Returns project and engine metadata.

No parameters.

Returns

Field Type Description
project_namestringCurrent project name
engine_versionstringFull engine version string
project_dirstringProject root directory
project_content_dirstringProject Content/ directory
current_levelstringCurrently loaded level name

Example Request

{ "jsonrpc": "2.0", "id": 1, "method": "editor.state.getProjectInfo" }

Example Response

{
  "jsonrpc": "2.0", "id": 1,
  "result": {
    "project_name": "MyProject",
    "engine_version": "5.7.2-0+++UE5+Release-5.7",
    "project_dir": "../../../MyProject/",
    "project_content_dir": "../../../MyProject/Content/",
    "current_level": "Lvl_FirstPerson"
  }
}

editor.state.undo

Undoes the most recent undoable action.

No parameters.

Returns

Field Type Description
successboolWhether the undo was performed
undone_actionstringDescription of the undone transaction (present when success is true)
reasonstringWhy undo was not possible (present when success is false)

Example Request

{ "jsonrpc": "2.0", "id": 1, "method": "editor.state.undo" }

Example Response

{
  "jsonrpc": "2.0", "id": 1,
  "result": { "success": true, "undone_action": "AgentUX: Spawn Actor" }
}

editor.state.redo

Redoes the most recently undone action.

No parameters.

Returns

Field Type Description
successboolWhether the redo was performed
redone_actionstringDescription of the redone transaction (present when success is true)
reasonstringWhy redo was not possible (present when success is false)

Example Request

{ "jsonrpc": "2.0", "id": 1, "method": "editor.state.redo" }

Example Response

{
  "jsonrpc": "2.0", "id": 1,
  "result": { "success": true, "redone_action": "AgentUX: Spawn Actor" }
}

editor.state.openAssetEditor

Opens an asset editor for the specified asset. If the asset is already open, brings its editor to the foreground.

Name Type Required Description
asset_pathstringYesFull UE asset path (e.g. /Game/Materials/M_Ground)

Returns

Field Type Description
successboolWhether the editor was opened successfully
asset_pathstringThe asset path that was opened
asset_namestringThe asset's short name
asset_classstringThe asset's class name

Example Request

{ "jsonrpc": "2.0", "id": 1, "method": "editor.state.openAssetEditor",
  "params": { "asset_path": "/Game/Materials/M_Ground" } }

Example Response

{
  "jsonrpc": "2.0", "id": 1,
  "result": {
    "success": true,
    "asset_path": "/Game/Materials/M_Ground",
    "asset_name": "M_Ground",
    "asset_class": "Material"
  }
}

editor.state.closeAssetEditor

Closes all editors currently open for the specified asset.

Name Type Required Description
asset_pathstringYesFull UE asset path (e.g. /Game/Materials/M_Ground)

Returns

Field Type Description
successboolWhether any editors were closed (false if none were open)
editors_closednumberNumber of editor instances that were closed
asset_pathstringThe asset path that was closed

Example Request

{ "jsonrpc": "2.0", "id": 1, "method": "editor.state.closeAssetEditor",
  "params": { "asset_path": "/Game/Materials/M_Ground" } }

Example Response

{
  "jsonrpc": "2.0", "id": 1,
  "result": {
    "success": true,
    "editors_closed": 1,
    "asset_path": "/Game/Materials/M_Ground"
  }
}