Skip to main content

ui_capture

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: ui  ·  Module: services.registry.capability_adapter

Maturity: stable (support status; independent of enabled state, readiness and permissions).

Description​

Start, poll or cancel a bounded UI Toolkit render capture.

Parameters​

NameTypeRequiredDescription
actionLiteral['render_ui']yesFeature action to perform.
pathstr | None—Assets-relative path (e.g., 'Assets/UI/MainMenu.uxml' or 'Assets/UI/Styles.uss'). For render_ui: optional UXML path to render directly without a scene GameObject.
targetstr | None—Target GameObject name or path for attach_ui_document / get_visual_tree / render_ui.
component_typeLiteral['auto', 'ui_document', 'panel_renderer'] | None—UI component for attach/detach, get_visual_tree, modify_visual_element and render_ui. Default auto preserves an existing UIDocument, otherwise resolves PanelRenderer; new attachments prefer PanelRenderer when available and fall back to UIDocument. Explicit panel_renderer selection requires the Editor's native PanelRenderer API.
capture_idstr | None—Deferred capture ID returned by render_ui. Supply this ID alone to poll the original request; optional target/output settings must match the start request. Omit to start a separate capture even with identical settings. Results expire after 30 seconds.
cancel_capturebool | None—Cancel the deferred capture owned by capture_id (default false). For render_ui.
warmup_updatesint | None—Edit-mode panel readback delay in Editor updates, 0 to 4 (default 0). Positive values return capture_id for polling/cancellation; no repaint guarantee or automatic retries. Play mode requires 0 and already captures at end of frame. For render_ui.
widthint | None—Render width in pixels, 1 to 8192 (default 1920). The frame may contain at most 33,554,432 pixels. For render_ui.
heightint | None—Render height in pixels, 1 to 8192 (default 1080). For render_ui.
include_imagebool | None—Return inline base64 PNG in the response (default false). For render_ui.
max_resolutionint | None—Max resolution for inline base64 image, 1 to 8192 (default 640; 0 selects the default). For render_ui.
screenshot_file_namestr | None—Custom file name for the render output (default: auto-generated). For render_ui.
output_folderstr | None—Optional folder for the render output. Project-relative (e.g. 'Assets/Screenshots' or 'Captures') or absolute path inside the project. Overrides the user's Editor preference. If omitted, falls back to the Editor preference, then to the built-in default (Assets/Screenshots). For render_ui.
unity_instancestr | int | None—Target Unity instance for this call: Name@hash or hash prefix; an integer selects only that exact port over stdio and is rejected over HTTP. Read mcpforunity://instances for available targets. Omit to use the legacy active selection or the sole available instance.

Returns​

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

Examples​

Render the current UI Toolkit document on HUD for a visual check. Use the actual GameObject and choose an output folder inside the project for the generated PNG.

MCP arguments
{
"action": "render_ui",
"target": "HUD",
"width": 640,
"height": 360,
"include_image": true,
"output_folder": "Captures"
}