Logo Unity Component

Unity Component

Cộng đồngPhổ biến
Besty0728
unity-component

Manage GameObject components

Tổng quan

Nhà phát hànhBesty0728
Kho mãUnity-Skills
Tên kỹ năngunity-component
Sao
1.8K
Bản fork
164
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI là Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Đầy đủ trong hướng dẫn

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được Besty0728 công bố trên GitHub. Hãy đọc nội dung nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Unity Component trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL thư mục kỹ năng bên dưới và xác nhận.
    https://github.com/Besty0728/Unity-Skills/tree/main/SkillsForUnity/unity-skills~/skills/component
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.

Sử dụng trong TypingMind

Bật Unity Component trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự tải Unity Component ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên Unity Component không bị giới hạn ở mô hình mà kỹ năng này được viết cho. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên kỹ năng chưa dùng không tốn chi phí.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Before calling any skill in this module: if you are about to call a skill with parameters guessed from its name or description, STOP — read this file (or fetch its schema via GET /skills/recommend?includeSchema=true) first. If you already have the parameter definitions from recommend/schema, you may proceed straight to dryRun.

Triggers

  • Attaching or removing components
  • Copying components between objects
  • Toggling components
  • Reading/writing serialized fields
  • 挂载或移除组件、在对象间复制组件、开关组件、读写序列化字段

Unity Component Skills

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

Operating Mode

  • Approval:本模块 Mixed —— component_list / component_get_properties 标 SkillMode.SemiAuto,可直接执行;写类 skill (component_add / component_set_property / component_set_enabled / component_copy 等) 标 SkillMode.FullAuto,需 grant 单次执行返结果。
  • Auto / Bypass:FullAuto 直接执行。
  • 含 NeverInSemi 高危 skill:component_remove / component_remove_batch(Operation.Delete)。这些在 Approval/Auto 下返 MODE_FORBIDDEN,仅 Bypass 或 Allowlist 命中可调。

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
component_set_serialized_propertycomponent_set_serialized_property_batchSetting Inspector SerializedProperty paths

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
  • component_get_serialized_properties - List Inspector SerializedProperty paths
  • component_copy_exact - Copy a component and verify serialized fields match

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} (returns {warning, gameObject, instanceId} instead if a single-instance component already exists)

component_remove

Remove a component from a GameObject.

ParameterTypeRequiredDefaultDescription
namestringNo*-GameObject name
instanceIdintNo*-Instance ID
pathstringNo*-Hierarchy path
componentTypestringYes-Component type to remove
componentIndexintNo0Index into the components of that type when 2+ exist on the same object

Returns: {success, gameObject, removed} (removed is the requested componentType string)

component_list

List all components on a GameObject.

ParameterTypeRequiredDescription
namestringNo*GameObject name
instanceIdintNo*Instance ID

Returns: {gameObject, instanceId, path, componentCount, components: [{type, fullType, enabled, keyProperties?}]} (keyProperties only present when includeProperties=true)

component_set_property

Set a component property value.

ParameterTypeRequiredDescription
namestringNo*GameObject name
instanceIdintNo*Instance ID
pathstringNo*Hierarchy path
componentTypestringYesComponent type
propertyNamestringYesC# property/field name — see the serialized-name note below
valuestringCond.New value (basic types, vectors, colors, enums) — wire format below
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.)

Which of the four value parameters to use — exactly one carries the payload, and they are checked in this order: assetPath first, then referencePath / referenceName, and value only if neither reference form was supplied. So a value sent alongside an assetPath is silently ignored; never send two.

UseWhen the target field isExample
valuea primitive, vector, colour, enum, LayerMask, Rect, Bounds, Quaternionvalue="2.5", value="Interpolate"
referencePatha scene object, addressed by hierarchy path (unambiguous)referencePath="Root/Player/Hand"
referenceNamea scene object, addressed by name (first match wins)referenceName="Player"
assetPatha project asset — Material, Texture, AudioClip, ScriptableObject, PrefabassetPath="Assets/Materials/Red.mat"

Wire format of value — multi-component values travel as a comma-separated string: "1,2,3" for a Vector3, "1,0.5,0,1" for an RGBA colour, "0,90,0" for a Quaternion (3 values = Euler, 4 = xyzw). The JSON object form ({"x":1,"y":2,"z":3} / {"r":1,"g":0,"b":0,"a":1}) is accepted only for Vector2/Vector3/Vector4 and Color/Color32, and every component is required: {"y":2} for a Vector3 is rejected naming the missing x, z rather than silently zeroing them. The one optional key is a colour's a, which defaults to 1 — r, g, b are required. An explicit null counts as not supplied, so it fails the same way for a required key. An unrecognised key is rejected with the list of keys that were expected, and a non-numeric value is rejected naming the offending key. Vector2Int/Vector3Int, Quaternion, Rect and Bounds take the comma-separated string only — a JSON object for those fails. Colours additionally accept #RRGGBB / #RRGGBBAA hex and ten names: red, green, blue, white, black, yellow, cyan, magenta, gray/grey, clear. Enums take the member name, case-insensitively. Bools accept true/1/yes/on.

python
# 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
call_skill("component_set_property", name="Obj", componentType="Transform", propertyName="localPosition",
           value="1,2,3")

# Color — comma string, hex, or a name
call_skill("component_set_property", name="Obj", componentType="Light", propertyName="color", value="1,0.5,0,1")
call_skill("component_set_property", name="Obj", componentType="Light", propertyName="color", value="#FF8000")

# Enum (member name)
call_skill("component_set_property", name="Obj", componentType="Rigidbody", propertyName="interpolation",
           value="Interpolate")

Returns: {success, gameObject, component, property, valueSet, valueType} (valueSet is the string form of the actual value applied; valueType is the resolved target type name)

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, fullType, value, canWrite}], fields: [{name, type, fullType, value, isSerializable}]}

component_get_serialized_properties

List Inspector serialized properties on a component via SerializedObject.

ParameterTypeRequiredDescription
namestringNo*GameObject name
instanceIdintNo*Instance ID
pathstringNo*Hierarchy path
componentTypestringYesComponent type
includeChildrenboolNoInclude nested properties
limitintNoMax properties returned

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

The names here are not the names you write with. This skill reads Unity's serialized backing fields, so a Rigidbody's kinematic flag comes back as m_IsKinematic, its mass as m_Mass. component_set_property / component_get_properties work on the C# API names instead — isKinematic, mass. To convert: drop the m_ prefix and lowercase the first letter. Feed the m_-prefixed path back only to component_set_serialized_property, which expects a propertyPath verbatim. Writing m_IsKinematic through component_set_property fails with "Property/field not found" (and the error lists the available properties).

component_set_serialized_property

Set an Inspector serialized property by propertyPath.

ParameterTypeRequiredDescription
namestringNo*GameObject name
instanceIdintNo*Instance ID
pathstringNo*Hierarchy path
componentTypestringYesComponent type
propertyPathstringYesSerializedProperty path, e.g. items.Array.data[0]
valuestringCond.Primitive/vector/color/enum value
referenceNamestringNoScene object name for ObjectReference
referenceInstanceIdintNoScene object instance ID for ObjectReference
referencePathstringNoScene object path for ObjectReference
assetPathstringNoProject asset path for ObjectReference
objectTypestringNoExpected object/component type for references

Provide value for scalar properties, or a scene/project reference for ObjectReference fields.

Returns: {success, gameObject, component, propertyPath, valueSet}


Batch Skills

component_add_batch

Add components to multiple objects.

ParameterTypeRequiredDefaultDescription
itemsjson stringYes-JSON array of per-item objects (see example below)

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

python
unity_skills.call_skill("component_add_batch", items=[
    {"name": "Enemy1", "componentType": "Rigidbody"},
    {"name": "Enemy2", "componentType": "Rigidbody"},
    {"name": "Enemy3", "componentType": "Rigidbody"}
])

component_remove_batch

Remove components from multiple objects.

ParameterTypeRequiredDefaultDescription
itemsjson stringYes-JSON array of per-item objects (see example below)

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

python
unity_skills.call_skill("component_remove_batch", items=[
    {"instanceId": 12345, "componentType": "BoxCollider"},
    {"instanceId": 12346, "componentType": "BoxCollider"}
])

component_set_property_batch

Set properties on multiple objects.

ParameterTypeRequiredDefaultDescription
itemsjson stringYes-JSON array of per-item objects (see example below)

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

python
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}
])

component_set_serialized_property_batch

Set Inspector serialized properties on multiple components.

ParameterTypeRequiredDefaultDescription
itemsjson stringYes-JSON array of per-item objects

Item properties: name, instanceId, path, componentType, propertyPath, value, referenceName, referenceInstanceId, referencePath, assetPath, objectType

Returns: {success, totalItems, successCount, failCount, results}


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

python
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}
])

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_copy_exact

Copy a component from one GameObject to another and verify serialized Inspector fields match.

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

Returns: { success, source, target, componentType, verified, mismatchCount, mismatches? }

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 }


Exact Signatures

Exact names, parameters, defaults, and returns are defined by GET /skills/schema or unity_skills.get_skill_schema(), not by this file.

Common Errors

Full transport-level codes (COMPILING/RATE_LIMIT etc.) → ../../references/protocol-error-codes.md

ErrorTriggerFix
TARGET_NOT_FOUNDThe GameObject, component type, component instance, property/field, or asset reference could not be located.List components with component_list, resolve asset paths with asset_find, or verify the object with gameobject_find / scene_get_hierarchy.
MISSING_PARAMA required parameter is missing, such as componentType in component_add or componentType/propertyName in component_set_property.Provide the missing parameter; use mode=dryRun to preview the required arguments.
SEMANTIC_INVALIDA value is out of range or otherwise invalid, such as a componentIndex that exceeds the available components.Adjust the value to fit the valid range or enum described in the error message.
SKILL_ERRORA runtime constraint blocked the operation, such as a read-only property or a component that cannot be removed because it is required.Read the error message, resolve the underlying constraint (e.g., choose a writable property), then retry.

Câu hỏi thường gặp

Kỹ năng AI Unity Component làm được gì?

Manage GameObject components

Vì sao nên dùng Unity Component trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Unity Component là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Unity Component trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/Besty0728/Unity-Skills/tree/main/SkillsForUnity/unity-skills~/skills/component. TypingMind đọc tệp SKILL.md và cài đặt thành một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Unity Component?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Bạn có thể dùng Unity Component với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Unity Component với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Unity Component có miễn phí không?

Có. Kỹ năng này được Besty0728 phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp cho mô hình các công cụ mới để gọi — mã được chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và tiêu chí của đầu ra tốt. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇