agentleFS
batihandevbatihandev/unity-mcp-skills/skills/component/SKILL.md

unity-component

Skill7 starsChanged 7 months agoMITView on GitHub

Use when users want to add, remove, or configure components like Rigidbody, Collider, AudioSource.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 6 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Add a component to a GameObject.

    line 47
  2. Distinctive:

    Remove a component from a GameObject.

    line 61
  3. Distinctive:

    Add components to multiple objects.

    line 118
  4. Distinctive:

    Remove components from multiple objects.

    line 125
  5. Distinctive:

    Add colliders before Rigidbody for physics

    line 183
  6. Very specific:

    Use component_list to verify additions

    line 184
  7. Very specific:

    Check property names with component_get_properties first

    line 185
  8. Distinctive:

    Use full type names for custom scripts (e.g., "MyNamespace.MyScript")

    line 187

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Unity Component Skills

Overview

BATCH-FIRST: Use *_batch skills when operating on 2+ objects to reduce API calls from N to 1.

Common Mistakes

DO NOT (common hallucinations):

  • component_create / component_get do not exist → use component_add (add) and component_get_properties (read)
  • component_find does not exist → use component_list to list components on an object
  • componentType is case-sensitive — Rigidbody not rigidbody, BoxCollider not boxcollider
  • Custom scripts need exact class name; if namespaced, use Namespace.ClassName

Routing:

  • To create a C# component script → use script module's script_create first, then component_add
  • To set multiple properties at once → use component_set_property_batch
  • To enable/disable a component → component_set_enabled (not component_set_property)

Object Targeting: All single-object skills accept name (string), instanceId (int, preferred), and path (string, hierarchy path). Provide at least one.

Skills Overview

Single ObjectBatch VersionUse Batch When
component_addcomponent_add_batchAdding to 2+ objects
component_removecomponent_remove_batchRemoving from 2+ objects
component_set_propertycomponent_set_property_batchSetting on 2+ objects

Other Skills (no batch):

  • component_list - List all components on an object
  • component_get_properties - Get component property values
  • component_set_enabled - Enable/disable a component (Behaviour, Renderer, Collider)
  • component_copy - Copy a component from one object to another

Single-Object Skills

component_add

Add a component to a GameObject.

ParameterTypeRequiredDescription
namestringNo*GameObject name
instanceIdintNo*Instance ID (preferred)
pathstringNo*Hierarchy path
componentTypestringYesComponent type name

*At least one identifier required

Returns: {success, gameObject, instanceId, component, fullTypeName}

component_remove

Remove a component from a GameObject.

ParameterTypeRequiredDescription
namestringNo*GameObject name
instanceIdintNo*Instance ID
componentTypestringYesComponent type to remove

Returns: {success, gameObject, removed}

component_list

List all components on a GameObject.

ParameterTypeRequiredDescription
namestringNo*GameObject name
instanceIdintNo*Instance ID

Returns: {gameObject, instanceId, path, componentCount, components: [{type, fullType, enabled}]}

component_set_property

Set a component property value.

ParameterTypeRequiredDescription
namestringNo*GameObject name
instanceIdintNo*Instance ID
componentTypestringYesComponent type
propertyNamestringYesProperty to set
valueanyCond.New value (for basic types, vectors, colors)
referencePathstringNoScene object hierarchy path (for scene references)
referenceNamestringNoScene object name (for scene references)
assetPathstringNoProject asset path (for asset references: Material, Texture, AudioClip, ScriptableObject, Prefab, etc.)

Provide one of: value (basic types), referencePath/referenceName (scene objects), or assetPath (project assets).

value type examples: See ../../recipes/component/component_set_property.md for value format details and C# template.

Returns: {success, gameObject, component, property, valueSet, valueType}

component_get_properties

Get all properties of a component.

ParameterTypeRequiredDescription
namestringNo*GameObject name
instanceIdintNo*Instance ID
componentTypestringYesComponent type

Returns: {gameObject, component, fullTypeName, properties: [{name, type, value, canWrite}], fields: [{name, type, value, isSerializable}]}


Batch Skills

component_add_batch

Add components to multiple objects.

Returns: {success, totalItems, successCount, failCount, results: [{success, gameObject, componentType, added}]}

See ../../recipes/component/component_add_batch.md for C# template.

component_remove_batch

Remove components from multiple objects.

Returns: {success, totalItems, successCount, failCount, results: [{success, gameObject, componentType, removed}]}

See ../../recipes/component/component_remove_batch.md for C# template.

component_set_property_batch

Set properties on multiple objects.

Returns: {success, totalItems, successCount, failCount, results: [{success, gameObject, componentType, property, oldValue, newValue}]}

See ../../recipes/component/component_set_property_batch.md for C# template.


Common Component Types

Physics

TypeDescription
RigidbodyPhysics simulation
BoxColliderBox collision
SphereColliderSphere collision
CapsuleColliderCapsule collision
MeshColliderMesh-based collision
CharacterControllerCharacter movement

Rendering

TypeDescription
MeshRendererRender meshes
SkinnedMeshRendererAnimated meshes
SpriteRenderer2D sprites
LineRendererDraw lines
TrailRendererMotion trails

Audio

TypeDescription
AudioSourcePlay sounds
AudioListenerReceive audio

UI

TypeDescription
CanvasUI container
ImageUI images
TextUI text (legacy)
ButtonClickable button

Example: Efficient Physics Setup

See ../../recipes/component/README.md for all component recipes.

Best Practices

  1. Add colliders before Rigidbody for physics
  2. Use component_list to verify additions
  3. Check property names with component_get_properties first
  4. Some properties are read-only (will fail to set)
  5. Use full type names for custom scripts (e.g., "MyNamespace.MyScript")

Additional Skills

component_copy

Copy a component from one GameObject to another.

ParameterTypeRequiredDefaultDescription
sourceNamestringNo*nullSource GameObject name
sourceInstanceIdintNo*0Source Instance ID
sourcePathstringNo*nullSource hierarchy path
targetNamestringNo*nullTarget GameObject name
targetInstanceIdintNo*0Target Instance ID
targetPathstringNo*nullTarget hierarchy path
componentTypestringYes-Component type to copy

*At least one source identifier and one target identifier required

Returns: { success, source, target, componentType }

component_set_enabled

Enable or disable a component (Behaviour, Renderer, Collider, etc.).

ParameterTypeRequiredDefaultDescription
namestringNo*nullGameObject name
instanceIdintNo*0Instance ID
pathstringNo*nullHierarchy path
componentTypestringYes-Component type to enable/disable
enabledboolNotrueWhether to enable or disable

*At least one identifier required

Returns: { success, gameObject, componentType, enabled }


Recipe path rule: ../../recipes/component/<command>.md

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.