gameobject_duplicate
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: scene · Module: services.registry.capability_adapter
Maturity: stable (support status; independent of enabled state, readiness and permissions).
Description
Duplicate a GameObject with optional name, parent and position changes.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
action | Literal['duplicate'] | yes | Feature action to perform. |
target | str | None | — | GameObject identifier by name, path, or instance ID for modify/delete/duplicate actions |
search_method | Literal['by_id', 'by_name', 'by_path', 'by_tag', 'by_layer', 'by_component'] | None | — | How to resolve 'target'. If omitted, Unity infers: instance ID -> by_id, path (contains '/') -> by_path, otherwise by_name. Delete removes all matches, including inactive objects; use by_id with a current instance ID to delete one object. |
name | str | None | — | GameObject name for 'create' (initial name) and 'modify' (rename) actions. |
parent | str | None | — | Parent GameObject reference - used for both 'create' (initial parent) and 'modify' (change parent) |
position | list[float] | dict[str, float] | str | None | — | Position as [x, y, z] array, {x, y, z} object, or JSON string |
new_name | str | None | — | New name for the duplicated object (default: SourceName_Copy) |
offset | list[float] | str | None | — | Offset from original/reference position as [x, y, z] array (list or JSON string) |
unity_instance | str | 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
Duplicate a scene marker, give the copy a new name, and offset it by two units on X. Use the unique name or current instance ID of the source object.
MCP arguments
{
"action": "duplicate",
"target": "Prototype Marker",
"search_method": "by_name",
"new_name": "Prototype Marker B",
"offset": [
2,
0,
0
]
}