unity-animation
Qué hace
Explica cómo controlar la animación de personajes en Unity usando Animator Controllers. Es para desarrolladores que animan personajes con esqueleto en Unity 6.
Cuándo usarla
- ✓Cuando necesitas conectar animaciones de caminar, correr y saltar en una máquina de estados en Unity.
- ✓Cuando quieres cambiar animaciones desde un script usando parámetros.
- ✓Cuando quieres que una acción de la parte superior del cuerpo se reproduzca sobre el movimiento, o que los pies y las manos se adapten al suelo.
Link de la skill
https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/unity/unity-animation/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Haz que mi personaje de Unity pase de reposo a caminar y a correr según la velocidad con la que se mueve.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
Explica cómo crear estados y transiciones con parámetros, mezclar animaciones con árboles de mezcla, superponer acciones y establecer valores desde el script para que la máquina de estados elija la animación correcta.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de GitHub.
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); // 0.1 = 10% of the state's length, not seconds
_anim.CrossFadeInFixedTime("Hit", 0.15f); // duration in seconds
// Or jump instantly: _anim.Play("Hit");
4. Wait until the current state finishes
private System.Collections.IEnumerator AfterAttack()
{
yield return null; // let the Animator start the transition
// During a transition the "current" state is the one being left; read the next one.
var info = _anim.IsInTransition(0)
? _anim.GetNextAnimatorStateInfo(0)
: _anim.GetCurrentAnimatorStateInfo(0); // layer 0
yield return new WaitForSeconds(info.length); // seconds; approximate, varies in blend trees
// ...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. Un
Preguntas frecuentes
¿Debo cambiar los estados de animación directamente desde el código?
No. La skill indica establecer parámetros desde el código y dejar que la máquina de estados decida las transiciones.
¿Qué es un Avatar en Unity?
Un Avatar es la configuración que permite que un modelo humanoide reutilice animaciones y use cinemática inversa.
¿Cubre fundidos sencillos de interfaz?
No. Esos se hacen mejor con un tween o una corrutina, que cubre una skill de scripting.
Detalles
Descripción original del autor
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.
Popularidad
- Estrellas en GitHub
- 6,6 mil
- Posición en el ranking
- #13844
- Licencia
- Apache-2.0
- Actualizada
- 28/10/2026
Comentarios
- …
Más skills de este repositorio
router
6,6 milAyuda a tu agente a elegir la skill de desarrollo de juegos adecuada para cada petición, detectando tu motor y el tipo de tarea que necesitas.
ai-behavior-trees-utility-ai
6,6 milAyuda a tu agente a construir un árbol de comportamiento y un sistema de IA por utilidad para enemigos y personajes que eligen acciones según prioridad y puntuación.
audio-design
6,6 milEnseña a tu agente la mezcla de audio de juegos: buses, volumen en decibelios, ducking bajo los diálogos, música adaptativa y variación de efectos de sonido.
camera-systems
6,6 milAyuda a tu agente a crear cámaras de juego que siguen con suavidad, se mantienen dentro del nivel y orbitan o miran alrededor en 3D.
Skills parecidas
diffs
394 milPermite que tu agente genere un diff real y compartible de los cambios, como enlace de visualización o archivo de imagen, en lugar de un resumen escrito a mano.
coding-agent
394 milAyuda a tu agente a pasar un trabajo de programación grande a Codex, Claude Code u OpenCode como trabajador en segundo plano, y después revisar su progreso.
gh-issues
394 milAyuda a tu agente a encontrar incidencias de GitHub, elegir cuáles trabajar y abrir pull requests con correcciones, incluido el seguimiento de los comentarios de revisión.