unity-animation
gamedev-skills/awesome-gamedev-agent-skills
Drive character animation in Unity 6.3 LTS with Animator Controllers, parameters, blend trees, and IK.
What is unity-animation?
Skill for wiring Animator Controllers and controlling character animation state from script using parameters, transitions, and blend trees. Use when building locomotion blends, layering upper-body actions, applying humanoid IK, or connecting animation clips into a state machine.
- Set animation parameters (Float, Bool, Trigger, Integer) from script to drive state transitions
- Build and control 1D/2D blend trees for smooth locomotion (idle→walk→run) and multi-axis motion
- Layer additive or override animations with Avatar Masks and control layer weights
- Apply humanoid IK for foot and hand placement on rigged characters
- Cross-fade between states or play animations directly for immediate transitions
- Query animator state info and wait for animation clips to finish
How to install unity-animation
npx skills add https://github.com/gamedev-skills/awesome-gamedev-agent-skills --skill unity-animation- Unity 6.3 LTS (6000.3) or compatible version
- A rigged 3D character model with an Animator component and Animator Controller asset
- For IK: a Humanoid-rigged model with a valid Avatar
How to use unity-animation
- 1.Create or open an Animator Controller and define parameters (Speed, IsGrounded, Jump, etc.)
- 2.Add states and transitions; set transition conditions to read your parameters
- 3.Assign the controller to an Animator component on your character model
- 4.In your character script, cache parameter hashes using Animator.StringToHash()
- 5.Call SetFloat, SetBool, SetInteger, or SetTrigger each frame or on events to drive the state machine
- 6.Test in Play mode using the Animator window to verify state transitions and parameter values
- 7.For layered animations, assign Avatar Masks and adjust layer weights; for IK, implement OnAnimatorIK callbacks
Use cases
- Smooth locomotion blending where analog stick input drives idle/walk/run via a blend tree parameter
- Layering an upper-body aim or attack animation over lower-body movement using animation layers
- Triggering one-shot actions like jump or hit reactions from gameplay code
- Applying foot IK to keep a character's feet planted on uneven terrain
- Damping noisy input to prevent animation snapping or jittering
- Game programmers wiring character controllers to animation systems
- Gameplay engineers tuning locomotion and action state machines
- Character animators setting up Animator Controllers and blend trees
- Game designers prototyping character behavior with animation feedback
unity-animation FAQ
Use SetTrigger for one-shot events (jump, attack) that auto-reset after firing a transition. Use SetBool for sustained states (IsGrounded, IsAiming) that remain true/false until explicitly changed.
Most common causes: parameter name is misspelled (use Animator.StringToHash to avoid typos), the transition condition is not set up correctly, or the transition has 'Has Exit Time' checked when you need immediate response. Check the Animator window during Play mode to see which state is active.
Choose one: enable 'Apply Root Motion' if the animation clip contains movement data, or disable it and move the transform from script. Using both causes sliding or unresponsive movement.
Enable 'IK Pass' on the Animator layer, implement OnAnimatorIK() in your script, and call SetIKPositionWeight/SetIKPosition with a Humanoid Avatar. IK only works with Humanoid rigs.
Check the layer's Blend Mode (should be Additive or Override depending on intent), assign an Avatar Mask to isolate bones, and tune layerWeight between 0 and 1 to blend the effect.
Full instructions (SKILL.md)
Source of truth, from gamedev-skills/awesome-gamedev-agent-skills.
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*.animassets, 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
- Add an
Animatorto 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). - Define parameters on the controller —
Float(Speed),Bool(IsGrounded),Int,Trigger(Jump) — and states with transitions whose conditions read those parameters. - Set parameters from script, never poke states directly:
SetFloat,SetBool,SetInteger,SetTrigger. The state machine resolves transitions for you. - Blend continuous motion with a Blend Tree (one
Floatlike Speed drives idle↔walk↔run) instead of many discrete states + transitions. - Layer additive/override motion (e.g. an upper-body "aim" layer with an Avatar Mask) and
control its
layerWeight. - 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
SetTriggermissed or "sticks" — triggers are consumed by the next satisfied transition and auto-reset; if no transition consumes it, it can fire later unexpectedly. UseResetTriggerto clear, or prefer aBoolwhen the condition is a sustained state.- String parameter typos fail silently — a misspelled name just does nothing. Use
Animator.StringToHashand cache the int hashes. - Transition feels laggy —
Has Exit Timemakes 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 Motionis 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), readreferences/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.
Related skills
More from gamedev-skills/awesome-gamedev-agent-skills and the wider catalog.

unity-build-pipeline
Configure, script, and automate Unity 6.3 LTS player builds with platform targets, scripting backends, and CI integration.

unity-csharp-scripting
Write correct Unity 6 MonoBehaviour scripts with proper lifecycle, component caching, and coroutines.

unity-input-system
Wire player input in Unity 6.3 LTS with action-based, device-agnostic Input System package.

unity-navmesh
Add AI pathfinding to Unity 6.3 LTS with NavMesh baking and agent steering.

unity-physics
Set up 3D physics in Unity 6.3 LTS: Rigidbody movement, colliders, collisions, raycasts, and joints.

unity-scriptableobjects
Design data-driven Unity systems with ScriptableObject assets for config, events, and registries without singletons.