gamedev-unity/skills/unity-skills/skills/animator/SKILL.md
Edit Unity Animator Controllers and control runtime parameters — manage states, transitions, layers, and parameters (float/int/bool/trigger). Use when setting up or wiring an Animator, adjusting animation state machines, or driving animation parameters at runtime, even if the user just mentions "动画" or "状态机". 编辑 Unity Animator Controller 并控制运行时参数(状态、过渡、层、参数 float/int/bool/trigger);当用户要搭建或连接 Animator、调整动画状态机、或在运行时驱动动画参数时使用。
npx skillsauth add bernatmv/ai-rules unity-animatorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Control Unity's Mecanim system — create Animator Controllers, add layers' states / transitions / parameters, assign controllers to GameObjects, set parameters at runtime, and play states.
animator_get_parameters / animator_get_info / animator_list_states,源码标 SkillMode.SemiAuto)直接执行;其余变更类(create_controller / add_parameter / set_parameter / play / assign_controller / add_state / add_transition,标 SkillMode.FullAuto)需用户 grant,grant 后服务端一步执行返结果。animator_set_parameter / animator_play 作用于场景中已挂 Animator 的 GameObject;如果当前不在 Play mode,状态机只在 Editor 预览模式推进,效果与 runtime 不完全等价。DO NOT (common hallucinations):
animator_create_clip / animator_add_clip do not exist → AnimationClips are created via Unity Editor or asset importanimator_set_speed does not exist → use component_set_property on Animator component with propertyName="speed"Routing:
timeline modulecomponent moduleimporter module| Skill | Description |
|-------|-------------|
| animator_create_controller | Create new Animator Controller |
| animator_add_parameter | Add parameter to controller |
| animator_get_parameters | List all parameters |
| animator_set_parameter | Set parameter value at runtime |
| animator_play | Play animation state |
| animator_get_info | Get Animator component info |
| animator_assign_controller | Assign controller to GameObject |
| animator_list_states | List states in controller |
| animator_add_state | Add a state to a controller layer |
| animator_add_transition | Add a transition between two states |
| Type | Description | Example Use |
|------|-------------|-------------|
| float | Decimal value | Speed, blend weights |
| int | Integer value | State index |
| bool | True/false | IsGrounded, IsRunning |
| trigger | One-shot signal | Jump, Attack |
Create a new Animator Controller.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| name | string | Yes | - | Controller name |
| folder | string | No | "Assets/Animations" | Save folder |
Returns: {success, name, path}
Add a parameter to a controller.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| controllerPath | string | Yes | - | Controller asset path |
| paramName | string | Yes | - | Parameter name |
| paramType | string | Yes | - | float/int/bool/trigger |
| defaultFloat | float | No | 0 | Initial float value |
| defaultInt | int | No | 0 | Initial int value |
| defaultBool | bool | No | false | Initial bool value |
Get all parameters from a controller.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| controllerPath | string | Yes | Controller asset path |
Returns: {controller, parameters: [{name, type, defaultFloat, defaultInt, defaultBool}]}
Set a parameter value at runtime (supports name/instanceId/path).
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| name | string | No* | GameObject name |
| instanceId | int | No* | GameObject instance ID |
| path | string | No* | GameObject hierarchy path |
| paramName | string | Yes | Parameter name |
| paramType | string | Yes | float/int/bool/trigger |
| floatValue | float | No* | Float value |
| intValue | int | No* | Integer value |
| boolValue | bool | No* | Boolean value |
*At least one identifier required. Use the appropriate value for paramType (trigger doesn't need a value).
Play a specific animation state (supports name/instanceId/path).
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| name | string | No* | - | GameObject name |
| instanceId | int | No* | 0 | GameObject instance ID |
| path | string | No* | null | GameObject hierarchy path |
| stateName | string | Yes | - | Animation state name |
| layer | int | No | 0 | Animator layer |
| normalizedTime | float | No | 0 | Start time (0-1) |
*At least one identifier required.
Get Animator component information (supports name/instanceId/path).
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| name | string | No | null | GameObject name |
| instanceId | int | No | 0 | GameObject instance ID |
| path | string | No | null | GameObject hierarchy path |
Returns: {gameObject, instanceId, hasController, controllerPath, speed, applyRootMotion, updateMode, cullingMode, layerCount, parameterCount}
Assign a controller to a GameObject (supports name/instanceId/path).
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| name | string | No* | GameObject name |
| instanceId | int | No* | GameObject instance ID |
| path | string | No* | GameObject hierarchy path |
| controllerPath | string | Yes | Controller asset path |
*At least one identifier required.
List all states in a controller layer.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| controllerPath | string | Yes | - | Controller asset path |
| layer | int | No | 0 | Layer index |
Returns: {controller, layer, layerName, stateCount, states: [{name, tag, speed, hasMotion}]}
Add a state to an Animator Controller layer.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| controllerPath | string | Yes | - | Controller asset path |
| stateName | string | Yes | - | Name for the new state |
| clipPath | string | No | null | Animation clip asset path to assign |
| layer | int | No | 0 | Layer index |
Returns: {success, controller, stateName, layer}
Add a transition between two states in an Animator Controller.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| controllerPath | string | Yes | - | Controller asset path |
| fromState | string | Yes | - | Source state name |
| toState | string | Yes | - | Destination state name |
| layer | int | No | 0 | Layer index |
| hasExitTime | bool | No | true | Whether transition waits for exit time |
| duration | float | No | 0.25 | Transition duration in seconds |
Returns: {success, from, to, layer, hasExitTime, duration}
import unity_skills
# 1. Create controller
unity_skills.call_skill("animator_create_controller",
name="PlayerController",
folder="Assets/Animations"
)
# 2. Add parameters
unity_skills.call_skill("animator_add_parameter",
controllerPath="Assets/Animations/PlayerController.controller",
paramName="Speed", paramType="float", defaultFloat=0
)
unity_skills.call_skill("animator_add_parameter",
controllerPath="Assets/Animations/PlayerController.controller",
paramName="IsGrounded", paramType="bool", defaultBool=True
)
unity_skills.call_skill("animator_add_parameter",
controllerPath="Assets/Animations/PlayerController.controller",
paramName="Jump", paramType="trigger"
)
# 3. Assign to character
unity_skills.call_skill("animator_assign_controller",
name="Player",
controllerPath="Assets/Animations/PlayerController.controller"
)
# 4. Control at runtime
unity_skills.call_skill("animator_set_parameter",
name="Player", paramName="Speed", paramType="float", floatValue=5.0
)
# Trigger jump
unity_skills.call_skill("animator_set_parameter",
name="Player", paramName="Jump", paramType="trigger"
)
# Play specific state
unity_skills.call_skill("animator_play", name="Player", stateName="Idle")
Exact names, parameters, defaults, and returns are defined by GET /skills/schema or unity_skills.get_skill_schema(), not by this file.
development
Keyword research and validation with real search-demand data — never ship keywords from intuition alone. Probes Google Autocomplete per language (free, no account) to prove demand and discover the exact phrasing people type, checks SERPs for winnability, and uses Keyword Planner/Ahrefs/Semrush exports when the user has access. Activates when: choosing or reviewing SEO keywords, meta keywords, page titles, article topics or slugs, landing page copy targeting search, App Store/ASO keyword fields, multilingual keyword sets, 'what should we rank for', 'keyword analysis', or auditing why a page doesn't rank. Also invoke it as a validation pass whenever another skill or task produces a keyword list.
development
Automate YooAsset hot-update and asset bundles — build bundles, run Editor simulate builds, manage Collector groups, analyze BuildReport, and validate runtime. Use when building or simulating YooAsset bundles, configuring collectors, or validating hot-update assets, even if the user just says "热更" or "打AB包". 自动化 YooAsset 热更新与资源包(构建 bundle、编辑器模拟构建、管理 Collector 分组、分析 BuildReport、运行时校验);当用户要构建或模拟 YooAsset 资源包、配置 collector、或校验热更资源时使用。
development
Source-anchored design rules for YooAsset v2.3.18 — initialization, default-package shortcuts, play modes, asset handles, loading, updates, filesystem, build, and pitfalls. Use when writing or reviewing YooAsset code, initializing packages, loading assets via handles, setting up hot-update/download, or choosing a play mode, even if the user just says "热更" or "资源包". 为 YooAsset v2.3.18 提供源码锚定的设计规则(初始化、默认包快捷方式、运行模式、资源句柄、加载、更新、文件系统、构建、陷阱);当用户要编写或审查 YooAsset 代码、初始化 package、用句柄加载资源、配置热更/下载、或选择运行模式时使用。
data-ai
Last-resort guidance for safely hand-editing Unity serialized YAML (.unity/.prefab/.asset/.meta/ProjectSettings) — reference/fileID repair, GUID safety, and merge-conflict fixes. Use when REST cannot reach the change and YAML must be hand-edited — fixing m_Script GUIDs, broken fileID references, .meta files, or merge conflicts, even if the user just says "场景文件打不开" or "引用丢了". 安全手编 Unity 序列化 YAML(.unity/.prefab/.asset/.meta/ProjectSettings)的最后手段(引用/fileID 修复、GUID 安全、合并冲突修复);当 REST 无法触达、必须手编 YAML 时使用——修复 m_Script GUID、断裂 fileID 引用、.meta 文件或合并冲突。