/unity-animation
Drive Unity 6.3 LTS character animation with Animator Controllers: states, transitions, parameters, blend trees, animation layers, and humanoid Avatar IK. Use when wiring an Animator, setting parameters from script (SetFloat/SetBool/SetTrigger), building blend trees, or when the
$ npx -y skills add gamedev-skills/awesome-gamedev-agent-skills --skill unity-animation --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/unity-animation
Context preview
The summary Claude sees to decide when to auto-load this skill.
Drive Unity 6.3 LTS character animation with Animator Controllers: states, transitions, parameters, blend trees, animation layers, and humanoid Avatar IK. Use when wiring an Animator, setting parameters from script (SetFloat/SetBool/SetTrigger), building blend trees, or when the
SKILL.md
unity-animation.SKILL.mdname: unity-animation
description: >
Drive Unity 6.3 LTS character animation with Animator Controllers: states, transitions,
parameters, blend trees, animation layers, and humanoid Avatar IK. Use when wiring an
Animator, setting parameters from script (SetFloat/SetBool/SetTrigger), building blend
trees, or when the user mentions Animator, Mecanim, state machine, blend tree, or .controller.
Unity Animation (Animator / Mecanim)
Control animation state with Unity 6.3 LTS's `Animator` and Animator Controllers: parameters, transitions, blend trees, layers, and humanoid IK. Targets **Unity 6.3 LTS (6000.3)**.
When to use
- Use when connecting animation clips into a state machine, driving them from script via
parameters, blending locomotion (idle→walk→run), layering an upper-body action over movement, or adding foot/hand IK on a humanoid rig.
- Use when the project has `*.controller` (Animator Controller) and `*.anim` assets, or a
rigged model with an Avatar.
**When *not* to use:** simple non-skeletal value tweens (UI fades, position lerps) are better done with a tween/coroutine — see `unity-csharp-scripting`. Timeline cutscenes are a separate tool. 2D sprite frame animation also uses the Animator but with sprite keyframes.
Core workflow
1. **Add an `Animator`** to the model and assign an Animator Controller; for a humanoid model, set its rig to **Humanoid** so it has an Avatar (enables retargeting and IK). 2. **Define parameters** on the controller — `Float` (Speed), `Bool` (IsGrounded), `Int`, `Trigger` (Jump) — and states with transitions whose *conditions* read those parameters. 3. **Set parameters from script**, never poke states directly: `SetFloat`, `SetBool`, `SetInteger`, `SetTrigger`. The state machine resolves transitions for you. 4. **Blend continuous motion with a Blend Tree** (one `Float` like Speed drives idle↔walk↔run) instead of many discrete states + transitions. 5. **Layer additive/override motion** (e.g. an upper-body "aim" layer with an Avatar Mask) and control its `layerWeight`. 6. **Verify** in the Animator window during Play mode — the live state highlights and parameter values update, so you can see exactly which transition fired (or didn't).
Patterns
1. Drive locomotion + a one-shot action from script
using UnityEngine;
[RequireComponent(typeof(Animator))]
public class CharacterAnim : MonoBehaviour
{
private Animator _anim;
// Cache parameter hashes — faster and typo-proof vs string lookups every frame.
private static readonly int Speed = Animator.StringToHash("Speed");
private static readonly int IsGrounded= Animator.StringToHash("IsGrounded");
private static readonly int Jump = Animator.StringToHash("Jump");
private void Awake() => _anim = GetComponent<Animator>();
public void Tick(float planarSpeed, bool grounded)
{
_anim.SetFloat(Speed, planarSpeed); // drives a 1D blend tree (idle/walk/run)
_anim.SetBool(IsGrounded, grounded); // gates a falling/landing transition
}
public void DoJump() => _anim.SetTrigger(Jump); // fire-and-forget; auto-resets after use
}2. Smooth a noisy input into a blend parameter
// dampTime smooths Speed so the blend tree doesn't snap; great for analog sticks.
_anim.SetFloat(Speed, targetSpeed, 0.1f /* dampTime */, Time.deltaTime);
3. Play / cross-fade a state directly (bypassing parameter conditions)
// Useful for hit reactions where you want an immediate, explicit transition.
_anim.CrossFade("Hit", 0.1f); // blend over 0.1s normalized
// Or jump instantly: _anim.Play("Hit");4. Wait until the current state finishes
private System.Collections.IEnumerator AfterAttack()
{
var info = _anim.GetCurrentAnimatorStateInfo(0); // layer 0
yield return new WaitForSeconds(info.length); // approximate clip length
// ...follow-up logic
}Pitfalls
- **`SetTrigger` missed or "sticks"** — triggers are consumed by the next satisfied transition
and auto-reset; if no transition consumes it, it can fire later unexpectedly. Use `ResetTrigger` to clear, or prefer a `Bool` when the condition is a sustained state.
- **String parameter typos fail silently** — a misspelled name just does nothing. Use
`Animator.StringToHash` and cache the int hashes.
- **Transition feels laggy** — `Has Exit Time` makes the transition wait for the clip to reach
a normalized time. Uncheck it for responsive, condition-driven transitions (jump, hit).
- **Character slides or won't move** — `Apply Root Motion` is on but your code also moves the
transform (or vice versa). Decide: root motion *or* scripted movement, not both.
- **Upper-body layer overrides the whole body** — set the layer's Blend mode (Override vs
Additive), assign an Avatar Mask, and tune `layerWeight` (0–1).
- **IK does nothing** — IK only applies inside `OnAnimatorIK`, requires "IK Pass" enabled on
the layer, and needs a Humanoid Avatar.
References
- For **blend trees** (1D vs 2D Freeform/Directional), **animation layers + Avatar Masks**,
and **humanoid IK** (`OnAnimatorIK`, `SetIKPositionWeight`, `SetIKPosition`, look-at), read `references/blend-trees-and-ik.md`.
- Primary docs: Unity Manual "Animation" section and `ScriptReference/Animator`.
Related skills
- `unity-csharp-scripting` — the MonoBehaviour and coroutine timing used above.
- `unity-physics` — moving the body that the animation visualises.
- `game-ai` — deciding *when* to play which animation state.
Read more
name: unity-animation description: > Drive Unity 6.3 LTS character animation with Animator Controllers: states, transitions, parameters, blend trees, animation layers, and humanoid Avatar IK. Use when wiring an Animator, setting parameters from script (SetFloat/SetBool/SetTrigger), building blend trees, or when the user mentions Animator, Mecanim, state machine, blend tree, or .controller.
Unity Animation (Animator / Mecanim)
Control animation state with Unity 6.3 LTS's `Animator` and Animator Controllers: parameters, transitions, blend trees, layers, and humanoid IK. Targets **Unity 6.3 LTS (6000.3)**.
When to use
- Use when connecting animation clips into a state machine, driving them from script via
parameters, blending locomotion (idle→walk→run), layering an upper-body action over movement, or adding foot/hand IK on a humanoid rig.
- Use when the project has `*.controller` (Animator Controller) and `*.anim` assets, or a
rigged model with an Avatar.
**When *not* to use:** simple non-skeletal value tweens (UI fades, position lerps) are better done with a tween/coroutine — see `unity-csharp-scripting`. Timeline cutscenes are a separate tool. 2D sprite frame animation also uses the Animator but with sprite keyframes.
Core workflow
1. **Add an `Animator`** to the model and assign an Animator Controller; for a humanoid model, set its rig to **Humanoid** so it has an Avatar (enables retargeting and IK). 2. **Define parameters** on the controller — `Float` (Speed), `Bool` (IsGrounded), `Int`, `Trigger` (Jump) — and states with transitions whose *conditions* read those parameters. 3. **Set parameters from script**, never poke states directly: `SetFloat`, `SetBool`, `SetInteger`, `SetTrigger`. The state machine resolves transitions for you. 4. **Blend continuous motion with a Blend Tree** (one `Float` like Speed drives idle↔walk↔run) instead of many discrete states + transitions. 5. **Layer additive/override motion** (e.g. an upper-body "aim" layer with an Avatar Mask) and control its `layerWeight`. 6. **Verify** in the Animator window during Play mode — the live state highlights and parameter values update, so you can see exactly which transition fired (or didn't).
Patterns
1. Drive locomotion + a one-shot action from script
using UnityEngine;
[RequireComponent(typeof(Animator))]
public class CharacterAnim : MonoBehaviour
{
private Animator _anim;
// Cache parameter hashes — faster and typo-proof vs string lookups every frame.
private static readonly int Speed = Animator.StringToHash("Speed");
private static readonly int IsGrounded= Animator.StringToHash("IsGrounded");
private static readonly int Jump = Animator.StringToHash("Jump");
private void Awake() => _anim = GetComponent<Animator>();
public void Tick(float planarSpeed, bool grounded)
{
_anim.SetFloat(Speed, planarSpeed); // drives a 1D blend tree (idle/walk/run)
_anim.SetBool(IsGrounded, grounded); // gates a falling/landing transition
}
public void DoJump() => _anim.SetTrigger(Jump); // fire-and-forget; auto-resets after use
}2. Smooth a noisy input into a blend parameter
// dampTime smooths Speed so the blend tree doesn't snap; great for analog sticks. _anim.SetFloat(Speed, targetSpeed, 0.1f /* dampTime */, Time.deltaTime);
3. Play / cross-fade a state directly (bypassing parameter conditions)
// Useful for hit reactions where you want an immediate, explicit transition.
_anim.CrossFade("Hit", 0.1f); // blend over 0.1s normalized
// Or jump instantly: _anim.Play("Hit");4. Wait until the current state finishes
private System.Collections.IEnumerator AfterAttack()
{
var info = _anim.GetCurrentAnimatorStateInfo(0); // layer 0
yield return new WaitForSeconds(info.length); // approximate clip length
// ...follow-up logic
}Pitfalls
- **`SetTrigger` missed or "sticks"** — triggers are consumed by the next satisfied transition
and auto-reset; if no transition consumes it, it can fire later unexpectedly. Use `ResetTrigger` to clear, or prefer a `Bool` when the condition is a sustained state.
- **String parameter typos fail silently** — a misspelled name just does nothing. Use
`Animator.StringToHash` and cache the int hashes.
- **Transition feels laggy** — `Has Exit Time` makes the transition wait for the clip to reach
a normalized time. Uncheck it for responsive, condition-driven transitions (jump, hit).
- **Character slides or won't move** — `Apply Root Motion` is on but your code also moves the
transform (or vice versa). Decide: root motion *or* scripted movement, not both.
- **Upper-body layer overrides the whole body** — set the layer's Blend mode (Override vs
Additive), assign an Avatar Mask, and tune `layerWeight` (0–1).
- **IK does nothing** — IK only applies inside `OnAnimatorIK`, requires "IK Pass" enabled on
the layer, and needs a Humanoid Avatar.
References
- For **blend trees** (1D vs 2D Freeform/Directional), **animation layers + Avatar Masks**,
and **humanoid IK** (`OnAnimatorIK`, `SetIKPositionWeight`, `SetIKPosition`, look-at), read `references/blend-trees-and-ik.md`.
- Primary docs: Unity Manual "Animation" section and `ScriptReference/Animator`.
Related skills
- `unity-csharp-scripting` — the MonoBehaviour and coroutine timing used above.
- `unity-physics` — moving the body that the animation visualises.
- `game-ai` — deciding *when* to play which animation state.
<img src="docs/assets/banner.png" width="820" alt="awesome-gamedev-agent-skills — game-dev skills for AI coding agents.
Repo: gamedev-skills/awesome-gamedev-agent-skills
Other skills on awesome-gamedev-agent-skills.
- /audio-design
Implement game audio practice — bus/mixer architecture and gain in decibels, ducking (sidechain), adaptive/dynamic music via layering and re-sequencing, SFX variation, and beat synchronization. Engine-neutral. Use when the user mentions audio mixing, audio buses,
Open skill - /camera-systems
Build game cameras that feel good — 2D follow with a deadzone, look-ahead, smoothing, and level-bounds clamping; 3D third-person orbit with collision and first-person look; plus multi-target framing and a shake hook. Engine-neutral techniques that pair with the engine's camera
Open skill - /create-game-assets
Plan, generate, source, normalize, and validate cohesive visual game assets. Use for art direction, style bibles, sprites, tilesets, backgrounds, UI art, icons, textures, concept art, or 3D asset briefs.
Open skill - /dialogue-systems
Build branching dialogue and narrative — a node/choice graph with conditions, variables, and localization hooks — and choose between authoring tools Ink and Yarn Spinner or a custom data-driven runner. Engine-neutral. Use when the user mentions dialogue system, branching
Open skill - /game-ai
Design NPC and enemy decision-making with finite state machines, behavior trees, steering behaviors, and A* pathfinding — engine-neutral algorithms that pair with the detected engine's navigation API. Use when building enemy AI, an FSM or behavior tree, steering/flocking, or
Open skill - /game-feel
Add "juice" and game feel that makes actions satisfying — screen shake, hit-stop/freeze frames, tweened/eased motion, squash & stretch, knockback, and layered audio-visual feedback — as engine-neutral techniques that pair with the detected engine's tween, particle, and camera
Open skill

