unity_component_add
Add a built-in or custom script component to a Unity GameObject by specifying its path and the component type.
Instructions
Add a component to a GameObject. Supports built-in types (Rigidbody, BoxCollider, AudioSource, Light, Camera, etc.) and custom scripts.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"gameObjectPath": "<gameObjectPath>",
"componentType": "<componentType>"
},
"name": "unity_component_add"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| port | No | Unity instance port (from unity_select_instance). Always include it when multiple instances run. | |
| componentType | Yes | Full type name, e.g. 'Rigidbody', 'BoxCollider', 'MyNamespace.MyScript' | |
| gameObjectPath | Yes | Path or name of the target GameObject |