About unity-component
unity-component is a skill set for inspecting and changing components on Unity objects. It covers component management, property editing, and batch operations, including serialized-field verification.
Key features
- 01Add, remove, and copy components
- 02Toggle component enabled state
- 03Read component methods and properties
- 04Edit C# and serialized fields
- 05Batch changes with verification
Use cases
- 01Add or remove an object component
- 02Copy component settings between objects
- 03Inspect or update serialized fields
- 04Change components on multiple objects
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ besty0728/ unity-skills --skill unity-componentAfter installing, type/unity-componentin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
reference/component_add_batch.mdcomponent_add.mdcomponent_copy_exact.mdcomponent_copy.mdcomponent_get_methods_batch.mdcomponent_get_methods.mdcomponent_get_properties.mdcomponent_get_serialized_properties.mdcomponent_invoke_method_batch.mdcomponent_invoke_method.mdcomponent_list.mdcomponent_remove_batch.mdcomponent_remove.mdcomponent_set_enabled.mdcomponent_set_property_batch.mdcomponent_set_property.mdcomponent_set_serialized_property_batch.mdcomponent_set_serialized_property.mdDetails
From the project READMETriggers
- Attaching or removing components
- Copying components between objects
- Toggling components
- Reading/writing serialized fields
- 挂载或移除组件、在对象间复制组件、开关组件、读写序列化字段
Unity Component Skills
Add, remove, copy, toggle and edit components. Parameters come from the schema (recommend includeSchema=true or /skills/schema?names=), which notes the non-obvious ones — never from a skill's name. Execution, dryRun and verification rules: root SKILL.md.
Operating Mode
component_list, component_get_methods, component_get_methods_batch, component_get_properties, component_get_serialized_properties are SemiAuto (read-only); every writer is FullAuto. component_remove / component_remove_batch (Operation.Delete) and component_invoke_method* (high risk) are NeverInSemi: MODE_FORBIDDEN under Approval/Auto, run only under Bypass or an Allowlist hit → operating mode.
Shared rules
- Targets: single-object skills take
name,instanceIdorpath(plusentityId, resolved to the path), matched like GameObjects: an ambiguous fuzzy name returnsTARGET_NOT_FOUNDwithcandidates, non-exact matches are listed inresolutionNotes. Batch items take onlyname/instanceId/path: anentityIditem key is ignored (named inwarnings), so the item finds no target.component_copy*usesource*/target*identifiers. componentType(required): the class name —Rigidbody,BoxCollider,Namespace.ClassNamefor custom scripts. Unity, UI, TextMeshPro, Cinemachine and Input System namespaces are searched first, then a case-insensitive scan that takes the first matching type; the response'scomponent/fullTypeNameshow what was resolved.- Two naming schemes:
component_set_property/component_get_propertiesuse C# member names (mass,isKinematic; matched case-insensitively, private fields writable too).component_get_serialized_properties/component_set_serialized_propertyuse SerializedProperty paths (m_Mass,items.Array.data[0]; a baremassis retried asm_Mass). To convert, dropm_and lowercase the first letter; anm_name sent tocomponent_set_propertyfails with "Property/field not found" and lists the writable members. - Value source (
component_set_property, its batch,batch_preview_set_property): exactly one ofassetPath(project asset) >referencePath(scene object by path) /referenceName(by name, first match) >value, checked in that order; a lower one sent alongside is silently ignored. Sending none writes the type's default (0 / false / null). valueencoding: numbers and bools (true/false,1/0,yes/no,on/off; others rejected) as JSON or strings; enums by member name, case-insensitive; vectors, Quaternion (3 values = euler, 4 = xyzw), Rect (x,y,w,h) and Bounds (cx,cy,cz,sx,sy,sz) as comma strings ("1,2,3"); colours as"r,g,b[,a]"(0–1),#RRGGBB[AA]or a name (red, green, blue, white, black, yellow, cyan, magenta, gray/grey, clear); LayerMask as a layer name or an integer mask. The JSON object form ({"x":1,"y":2,"z":3},{"r":1,"g":0,"b":0}) works only for Vector2/3/4 and Color/Color32, with every component required (colouradefaults to 1; an explicitnullcounts as missing); partial objects, unknown keys and non-numbers are rejected naming the expected keys.- Read-back:
component_set_propertyreturnsvalueSetread from the component after the write, plusvalueRequestedonly when the setter clamped or normalised it;component_set_serialized_propertyre-reads after applying. No follow-up read needed. - Property/add/remove batches: all-or-nothing — one failed item reverts the whole call (
rolledBack:true, other itemsreverted:true); unknown item keys are named inwarnings.
Skills Overview
Invocation batches are non-atomic async jobs; details: method calls.
| Single | Batch |
|---|---|
component_add | component_add_batch |
component_get_methods | component_get_methods_batch |
component_invoke_method | component_invoke_method_batch |
component_remove | component_remove_batch |
component_set_property | component_set_property_batch |
component_set_serialized_property | component_set_serialized_property_batch |
No batch: component_list (types and enabled state), component_get_properties (C# members and values), component_get_serialized_properties (Inspector paths), component_copy, component_copy_exact (verifies every serialized field), component_set_enabled (Behaviour/Renderer/Collider on or off — not component_set_property).
Per-skill tables, item fields and return shapes: reference/<skill_name>.md — rarely needed, the schema notes the parameters.
DO NOT (common hallucinations):
component_create/component_getdo not exist → usecomponent_add(add) andcomponent_get_properties(read)component_finddoes not exist → usecomponent_listto list components on an object
Exact Signatures
Names, parameters, defaults and required flags come from GET /skills/schema?category=Component (or ?names=a,b), not this file.
Common Errors
| Error | Trigger → fix |
|---|---|
TARGET_NOT_FOUND | Object, component type, component on the object, member or asset missing → component_list, component_get_properties, asset_find, gameobject_find. |
MISSING_PARAM | e.g. componentType, propertyName, propertyPath → supply it; the error (or a dryRun) lists all parameters. |
SEMANTIC_INVALID | A value the target type rejects, componentIndex out of range, a component another one still requires (requiredBy: remove those first), or a failed batch item → fix per the message / results. |
SKILL_ERROR | Read-only property → pick a writable member. |
Transport codes (COMPILING, RATE_LIMIT, ...) → error codes.