Skip to main content

gameobject_create

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.registry.capability_adapter

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

Description​

Create a named GameObject with transform, components and optional prefab output. name must contain non-whitespace text. save_as_prefab=true requires a nonempty .prefab prefab_path or prefab_folder for the generated name.prefab destination. Action inputs: create: requires name.

Parameters​

NameTypeRequiredDescription
actionLiteral['create']yesFeature action to perform.
namestryesNonempty initial GameObject name.
tagstr | None—Tag name - used for both 'create' (initial tag) and 'modify' (change tag)
parentstr | None—Parent GameObject reference - used for both 'create' (initial parent) and 'modify' (change parent)
positionlist[float] | dict[str, float] | str | None—Position as [x, y, z] array, {x, y, z} object, or JSON string
rotationlist[float] | dict[str, float] | str | None—Rotation as [x, y, z] euler angles array, {x, y, z} object, or JSON string
scalelist[float] | dict[str, float] | str | None—Scale as [x, y, z] array, {x, y, z} object, or JSON string
spaceLiteral['local', 'world'] | None—Position/rotation space; local default. Scale is local only.
world_position_staysbool | str | None—Preserve world TRS when parenting; true default.
sibling_indexint | None—Zero-based final sibling index, validated before mutation.
components_to_addlist[str | dict[str, Any]] | dict[str, Any] | str | None—List of components to add during 'create' or 'modify'. Each entry is either a plain type name string (e.g. "BoxCollider") or an object {"typeName": "BoxCollider", "properties": {"size": [2, 2, 2]}} that adds the component with initial properties applied in the same call. Mixing both forms in one list is fine.
primitive_typestr | None—Primitive type for 'create' action
save_as_prefabbool | str | None—If True, saves the created GameObject as a prefab (accepts true/false or 'true'/'false')
prefab_pathstr | None—Path for prefab creation
prefab_folderstr | None—Folder for prefab creation
set_activebool | str | None—If True, sets the GameObject active (accepts true/false or 'true'/'false')
layerstr | None—Layer name
component_propertiesdict[str, dict[str, Any]] | str | None—Dictionary of component names to their properties to set. Works for both 'create' (applied to components already present on the new GameObject - add them via components_to_add first) and 'modify'. For example: {"MyScript": {"otherObject": {"find": "Player", "method": "by_name"}}} assigns GameObject {"MyScript": {"playerHealth": {"find": "Player", "component": "HealthComponent"}}} assigns Component Example set nested property: - Access shared material: {"MeshRenderer": {"sharedMaterial.color": [1, 0, 0, 1]}}
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​

Add a cube as a scene placeholder. Use an unused object name and position within the selected scene.

MCP arguments
{
"action": "create",
"name": "Prototype Marker",
"primitive_type": "Cube",
"position": [
0,
0.5,
0
]
}