Skip to main content

gameobject_positioning

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​

Move or orient a GameObject selected by target (or name). move_relative requires reference_object plus direction or offset; look_at requires look_at_target. Action inputs: move_relative: requires reference_object. look_at: requires look_at_target.

Parameters​

NameTypeRequiredDescription
actionLiteral['move_relative', 'look_at']yesFeature action to perform.
targetstr | None—GameObject identifier by name, path, or instance ID for modify/delete/duplicate actions
search_methodLiteral['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.
namestr | None—GameObject name for 'create' (initial name) and 'modify' (rename) actions.
offsetlist[float] | str | None—Offset from original/reference position as [x, y, z] array (list or JSON string)
reference_objectstr | None—Reference object for relative movement (required for move_relative)
directionLiteral['left', 'right', 'up', 'down', 'forward', 'back', 'front', 'backward', 'behind'] | None—Direction for relative movement (e.g., 'right', 'up', 'forward')
distancefloat | None—Distance to move in the specified direction (default: 1.0)
world_spacebool | str | None—If True (default), use world space directions; if False, use reference object's local directions
look_at_targetlist[float] | str | None—World position [x,y,z] or GameObject name/path/ID to look at (for look_at action).
look_at_uplist[float] | str | None—Optional up vector [x,y,z] for look_at. Defaults to [0,1,0].
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​

Orient a scene marker toward a target. Replace both names with unique objects in the selected scene, and confirm the marker's new rotation before saving.

MCP arguments
{
"action": "look_at",
"target": "Look Marker",
"search_method": "by_name",
"look_at_target": "Focus Target"
}