unity-component
Installation
SKILL.md
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.
When to use
- Attaching or removing components
- Copying components between objects
- Toggling components
- Reading/writing serialized fields
Rules
- Targets: single-object skills and batch items take
entityId,name,instanceIdorpath, matched like GameObjects: an id that names nothing isTARGET_NOT_FOUND, never a fallback; an ambiguous fuzzy name returnsTARGET_NOT_FOUNDwithcandidates; non-exact matches are listed inresolutionNotes.component_copy*usesource*/target*identifiers (sourceEntityId,targetEntityId, ...). 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.