Loading...
Loading...
GameObject component management. Use when users want to add, remove, or configure components like Rigidbody, Collider, AudioSource. Triggers: component, add component, rigidbody, collider, audio source, script, 组件, 添加组件, 刚体, 碰撞体.
npx skill4agent add besty0728/unity-skills unity-componentBATCH-FIRST: Useskills when operating on 2+ objects to reduce API calls from N to 1.*_batch
component_createcomponent_getcomponent_addcomponent_get_propertiescomponent_findcomponent_listcomponentTypeRigidbodyrigidbodyBoxColliderboxcolliderNamespace.ClassNamescriptscript_createcomponent_addcomponent_set_property_batchcomponent_set_enabledcomponent_set_propertyObject Targeting: All single-object skills accept(string),name(int, preferred), andinstanceId(string, hierarchy path). Provide at least one.path
| Single Object | Batch Version | Use Batch When |
|---|---|---|
| | Adding to 2+ objects |
| | Removing from 2+ objects |
| | Setting on 2+ objects |
component_listcomponent_get_propertiescomponent_set_enabledcomponent_copy| Parameter | Type | Required | Description |
|---|---|---|---|
| string | No* | GameObject name |
| int | No* | Instance ID (preferred) |
| string | No* | Hierarchy path |
| string | Yes | Component type name |
{success, gameObject, componentType, added}| Parameter | Type | Required | Description |
|---|---|---|---|
| string | No* | GameObject name |
| int | No* | Instance ID |
| string | Yes | Component type to remove |
{success, gameObject, componentType, removed}| Parameter | Type | Required | Description |
|---|---|---|---|
| string | No* | GameObject name |
| int | No* | Instance ID |
{success, gameObject, instanceId, components: [string]}| Parameter | Type | Required | Description |
|---|---|---|---|
| string | No* | GameObject name |
| int | No* | Instance ID |
| string | Yes | Component type |
| string | Yes | Property to set |
| any | Cond. | New value (for basic types, vectors, colors) |
| string | No | Scene object hierarchy path (for scene references) |
| string | No | Scene object name (for scene references) |
| string | No | Project asset path (for asset references: Material, Texture, AudioClip, ScriptableObject, Prefab, etc.) |
Provide one of:(basic types),value/referencePath(scene objects), orreferenceName(project assets).assetPath
value# float / int / bool / string
call_skill("component_set_property", name="Obj", componentType="Rigidbody", propertyName="mass", value=2.5)
call_skill("component_set_property", name="Obj", componentType="Rigidbody", propertyName="useGravity", value=False)
# Vector3 (JSON object with x, y, z)
call_skill("component_set_property", name="Obj", componentType="Transform", propertyName="localPosition",
value={"x": 1, "y": 2, "z": 3})
# Color (JSON object with r, g, b, a — values 0-1)
call_skill("component_set_property", name="Obj", componentType="Light", propertyName="color",
value={"r": 1, "g": 0.5, "b": 0, "a": 1})
# Enum (use string name)
call_skill("component_set_property", name="Obj", componentType="Rigidbody", propertyName="interpolation",
value="Interpolate"){success, gameObject, componentType, property, oldValue, newValue}| Parameter | Type | Required | Description |
|---|---|---|---|
| string | No* | GameObject name |
| int | No* | Instance ID |
| string | Yes | Component type |
{success, gameObject, componentType, properties: {name: value}}{success, totalItems, successCount, failCount, results: [{success, gameObject, componentType, added}]}unity_skills.call_skill("component_add_batch", items=[
{"name": "Enemy1", "componentType": "Rigidbody"},
{"name": "Enemy2", "componentType": "Rigidbody"},
{"name": "Enemy3", "componentType": "Rigidbody"}
]){success, totalItems, successCount, failCount, results: [{success, gameObject, componentType, removed}]}unity_skills.call_skill("component_remove_batch", items=[
{"instanceId": 12345, "componentType": "BoxCollider"},
{"instanceId": 12346, "componentType": "BoxCollider"}
]){success, totalItems, successCount, failCount, results: [{success, gameObject, componentType, property, oldValue, newValue}]}unity_skills.call_skill("component_set_property_batch", items=[
{"name": "Enemy1", "componentType": "Rigidbody", "propertyName": "mass", "value": 2.0},
{"name": "Enemy2", "componentType": "Rigidbody", "propertyName": "mass", "value": 2.0}
])| Type | Description |
|---|---|
| Physics simulation |
| Box collision |
| Sphere collision |
| Capsule collision |
| Mesh-based collision |
| Character movement |
| Type | Description |
|---|---|
| Render meshes |
| Animated meshes |
| 2D sprites |
| Draw lines |
| Motion trails |
| Type | Description |
|---|---|
| Play sounds |
| Receive audio |
| Type | Description |
|---|---|
| UI container |
| UI images |
| UI text (legacy) |
| Clickable button |
import unity_skills
# BAD: 6 API calls
unity_skills.call_skill("component_add", name="Box1", componentType="Rigidbody")
unity_skills.call_skill("component_add", name="Box2", componentType="Rigidbody")
unity_skills.call_skill("component_add", name="Box3", componentType="Rigidbody")
unity_skills.call_skill("component_set_property", name="Box1", componentType="Rigidbody", propertyName="mass", value=2.0)
unity_skills.call_skill("component_set_property", name="Box2", componentType="Rigidbody", propertyName="mass", value=2.0)
unity_skills.call_skill("component_set_property", name="Box3", componentType="Rigidbody", propertyName="mass", value=2.0)
# GOOD: 2 API calls
unity_skills.call_skill("component_add_batch", items=[
{"name": "Box1", "componentType": "Rigidbody"},
{"name": "Box2", "componentType": "Rigidbody"},
{"name": "Box3", "componentType": "Rigidbody"}
])
unity_skills.call_skill("component_set_property_batch", items=[
{"name": "Box1", "componentType": "Rigidbody", "propertyName": "mass", "value": 2.0},
{"name": "Box2", "componentType": "Rigidbody", "propertyName": "mass", "value": 2.0},
{"name": "Box3", "componentType": "Rigidbody", "propertyName": "mass", "value": 2.0}
])component_listcomponent_get_propertiescomponent_copy| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| string | No* | null | Source GameObject name |
| int | No* | 0 | Source Instance ID |
| string | No* | null | Source hierarchy path |
| string | No* | null | Target GameObject name |
| int | No* | 0 | Target Instance ID |
| string | No* | null | Target hierarchy path |
| string | Yes | - | Component type to copy |
{ success, source, target, componentType }component_set_enabled| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| string | No* | null | GameObject name |
| int | No* | 0 | Instance ID |
| string | No* | null | Hierarchy path |
| string | Yes | - | Component type to enable/disable |
| bool | No | true | Whether to enable or disable |
{ success, gameObject, componentType, enabled }GET /skills/schemaunity_skills.get_skill_schema()