Skip to main content

manage_scene

Auto-generated from the Python tool registry. Do not hand-edit outside <!-- examples:start --><!-- examples:end --> blocks — the generator (tools/generate_docs_reference.py) will overwrite them.

Group: core  ·  Module: services.tools.manage_scene

Description

Performs CRUD operations on Unity scenes. Read-only actions: get_hierarchy, get_active, get_build_settings, get_loaded_scenes, scene_view_frame. Modifying actions: create (with optional template), load (with optional additive flag), save, close_scene, set_active_scene, move_to_scene, validate (with optional auto_repair). For build settings management (add/remove/enable scenes), use manage_build(action='scenes'). For screenshots, use manage_camera (screenshot, screenshot_multiview actions).

Parameters

NameTypeRequiredDescription
actionLiteral['create', 'load', 'save', 'get_hierarchy', 'get_active', 'get_build_settings', 'scene_view_frame', 'close_scene', 'set_active_scene', 'get_loaded_scenes', 'move_to_scene', 'validate']yesPerform CRUD operations on Unity scenes and control the Scene View camera.
namestr | NoneScene name.
pathstr | NoneScene path.
build_indexint | str | NoneUnity build index (quote as string, e.g., '0').
scene_view_targetstr | int | NoneGameObject reference for scene_view_frame (name, path, or instance ID).
parentstr | int | NoneOptional parent GameObject reference (name/path/instanceID) to list direct children.
page_sizeint | str | NonePage size for get_hierarchy paging.
cursorint | str | NoneOpaque cursor for paging (offset).
max_nodesint | str | NoneHard cap on returned nodes per request (safety).
max_depthint | str | NoneAccepted for forward-compatibility; current paging returns a single level.
max_children_per_nodeint | str | NoneChild paging hint (safety).
include_transformbool | str | NoneIf true, include local transform in node summaries.
scene_namestr | NoneScene name for multi-scene operations.
scene_pathstr | NoneFull scene path (e.g. 'Assets/Scenes/Level2.unity').
targetstr | int | NoneGameObject reference (name, path, or instanceID) for move_to_scene.
remove_scenebool | str | NoneFor close_scene: true to fully remove, false to just unload.
additivebool | str | NoneFor load: true to open scene additively (keeps current scene).
templatestr | NoneFor create: scene template ('empty', 'default', '3d_basic', '2d_basic'). Omit for empty scene.
auto_repairbool | str | NoneFor validate: true to auto-fix missing scripts (undoable).

Returns

A dict containing the Unity response. The exact shape depends on the action.

Examples

Load a scene from Assets/Scenes/

Open Assets/Scenes/MainMenu.unity.

{
"action": "load",
"path": "Scenes/MainMenu.unity"
}

Paths are relative to Assets/. Forward slashes only.

Get the scene hierarchy (paged)

List every GameObject in the active scene.

{
"action": "get_hierarchy",
"page_size": 100
}

Returns up to page_size entries plus a next_cursor for the remainder. Always page large hierarchies.

Save the active scene

Save the active scene under its existing path.

{ "action": "save" }

Create a scene from a template

Make a new 3D scene called Lab.

{
"action": "create",
"path": "Scenes/Lab.unity",
"template": "3d_basic"
}

Other templates: 2d_basic, default, empty.

Additive multi-scene editing

Load Scenes/Boss.unity additively while keeping the current scene open.

{
"action": "load",
"path": "Scenes/Boss.unity",
"additive": true
}

Use set_active_scene, close_scene, and move_to_scene to compose multi-scene setups.