Add Component
unity_add_componentAttach a component by type to a GameObject in Unity, using Undo for safe edits. Check existing components first to avoid duplicates.
Instructions
Add a component by type name to a GameObject. Uses Undo.
Example: {"path":"Player","component_type":"Rigidbody"}. Check unity_get_components first to avoid duplicates.
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": {
"path": "<path>",
"component_type": "<component_type>"
},
"name": "unity_add_component"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Hierarchy path of the GameObject, e.g. 'Player' or 'Level/Enemies/Orc' | |
| component_type | Yes | Component type name, e.g. 'Rigidbody', 'BoxCollider', 'Light' |