unity-animation
БесплатноБез исполняемых скриптовНе проверенUnity 6.3 LTS character animation with the Animator (Mecanim): states and transitions, blend trees, Avatar Mask layers, root motion and humanoid IK. Use for…
от gamedev-skills★ 12 656 звёзд на GitHubОб этом скилле
Unity Animation (Animator / Mecanim)
Control animation state with the Animator and Animator Controllers in Unity 6.3 LTS
(6000.3): parameters, transitions, blend trees, layers and humanoid IK. A .controller file is
text YAML, so you can read its parameters and states without the Editor, and build one from
editor code instead of the Animator window.
When to use
- Connecting clips into a state machine, driving it from script, blending locomotion (idle, walk, run), layering an upper-body action over movement, foot or hand IK.
- The project has
*.controllerand*.animassets, or a rigged model with an Avatar.
When not to use: simple value tweens (UI fades, position lerps) → a coroutine in
unity-csharp-scripting; when an NPC should attack or flee → game-ai; Timeline cutscenes
have no skill here. 2D sprite frame animation uses the same Animator with sprite keyframes.
Workflow
- Read the controller before writing code. In the
.controllerYAML,m_AnimatorParameterslists each parameter'sm_Nameandm_Type(1 Float, 3 Int, 4 Bool, 9 Trigger), and eachAnimatorStatedocument has itsm_Name. Your script's strings must match these exactly. - Set the rig. Humanoid IK and retargeting need the model imported as Humanoid
(
animationType: 3in the model's.meta); ask before changing a model's rig, since it rebuilds the Avatar. - Drive locomotion with parameters (
SetFloat,SetBool,SetInteger,SetTrigger) through cachedAnimator.StringToHashids, and let transitions resolve. UseCrossFadeInFixedTimeonly for deliberate scripted cuts such as hit reactions. - Blend continuous motion with a blend tree driven by one
Float(or two for 2D directional) instead of many states and transitions. - Layer upper-body actions with an Avatar Mask and
SetLayerWeight. - Create or change controllers from code when the Editor UI is not available (pattern 3), then re-read the YAML to confirm.
- Verify with the checks below.
Patterns
1. Parameters from script with cached hashes
using UnityEngine;
[RequireComponent(typeof(Animator))]
public class CharacterAnim : MonoBehaviour
{
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 Animator _anim;
private void Awake() => _anim = GetComponent<Animator>();
public void Tick(float planarSpeed, bool grounded)
{
_anim.SetFloat(Speed, planarSpeed, 0.1f, Time.deltaTime); // damped: no snapping
_anim.SetBool(IsGrounded, grounded);
}
public void DoJump() => _anim.SetTrigger(Jump); // consumed by the next matching transition
}
2. Wait for the state you just triggered
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.
AnimatorStateInfo info = _anim.IsInTransition(0)
? _anim.GetNextAnimatorStateInfo(0)
: _anim.GetCurrentAnimatorStateInfo(0);
yield return new WaitForSeconds(info.length); // approximate inside blend trees
}
3. Build a controller from editor code
Put this in an Editor folder. Run it from a menu item, from the Unity CLI with
unity command script eval --code 'BuildLocomotionController.Build();', or in batch mode with
-executeMethod BuildLocomotionController.Build.
using UnityEditor;
using UnityEditor.Animations;
using UnityEngine;
public static class BuildLocomotionController
{
[MenuItem("Tools/Build Locomotion Controller")]
public static void Build()
{
if (!AssetDatabase.IsValidFolder("Assets/Animation"))
AssetDatabase.CreateFolder("Assets", "Animation");
var controller = AnimatorController.CreateAnimatorControllerAtPath("Assets/Animation/Player.controller");
controller.AddParameter("Speed", AnimatorControllerParameterType.Float);
controller.AddParameter("Jump", AnimatorControllerParameterType.Trigger);
AnimatorStateMachine sm = controller.layers[0].stateMachine;
AnimatorState locomotion = sm.AddState("Locomotion"); // assign a clip or blend tree as its motion
AnimatorState jump = sm.AddState("Jump");
sm.defaultState = locomotion;
AnimatorStateTransition toJump = locomotion.AddTransition(jump);
toJump.hasExitTime = false; // react to the trigger at once
toJump.duration = 0.1f;
toJump.AddCondition(AnimatorConditionMode.If, 0f, "Jump");
AnimatorStateTransition back = jump.AddTransition(locomotion);
back.hasExitTime = true; // return when the jump clip nearly ends
back.exitTime = 0.9f;
AssetDatabase.SaveAssets();
}
}
Verify
- **No Edito
Установить unity-animation в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл unity-animation?
Unity 6.3 LTS character animation with the Animator (Mecanim): states and transitions, blend trees, Avatar Mask layers, root motion and humanoid IK. Use for SetTrigger wiring, a transition that lags or never fires, sliding root motion, or an upper-body layer overriding the legs. Not for AI state machines (`game-ai`), juice (`game-feel`) or Godot (`godot-animation`).
Как установить скилл unity-animation?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл unity-animation запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
slack-gif-creator
Knowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request…
от Anthropicautomate-this
Analyze a screen recording of a manual process and produce targeted, working automation scripts. Extracts frames and audio narration from video files…
от GitHubfrom-the-other-side-vega
Patterns and lived experience from Vega, an AI partner in a deep long-term partnership. For Ember to draw on when working with humans who are building…
от GitHubplantuml-ascii
Generate ASCII art diagrams using PlantUML text mode. Use when user asks to create ASCII diagrams, text-based diagrams, terminal-friendly diagrams, or…
от GitHub