К основному содержанию
скилл CX Codex

unity-animation — скилл для Claude Code: Animator в Unity 6.3

Ведёт агента по Animator Controllers в Unity 6.3 LTS: параметры, переходы, blend trees, слои и humanoid IK. Пригодится, когда один персонаж должен ходить, прыгать и целиться из общей стейт-машины.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill unity-animation -a claude-code
Открыть на GitHub

Что делает unity-animation

Скилл задаёт агенту порядок работы с Animator Controllers в Unity 6.3 LTS (6000.3): состояния, переходы, параметры, blend trees, слои, humanoid IK. Логика такая: повесить Animator, объявить параметры Float, Bool, Int, Trigger, а из скрипта дёргать SetFloat, SetBool, SetTrigger. Состояния напрямую не переключают — переходы разрешает сама стейт-машина.

Внутри есть примеры кода: кэш хешей через Animator.StringToHash, сглаживание входа через dampTime, разница между CrossFade и CrossFadeInFixedTime, ожидание конца состояния через GetNextAnimatorStateInfo. Отдельный файл references/blend-trees-and-ik.md разбирает 1D и 2D Freeform blend trees, Avatar Mask и OnAnimatorIK.

Проект нужен на Unity 6.3 LTS. Ловушка, на которой спотыкаются чаще всего, — root motion: при включённом Apply Root Motion и скриптовом движении transform персонаж едет или встаёт на месте. Одно из двух. IK молчит без Humanoid Avatar и включённого IK Pass на слое.

Какие задачи решает

  • собрать idle → walk → run в один blend tree
  • прокинуть скорость из скрипта в параметр Speed
  • наложить слой прицеливания на верхнюю часть тела
  • поставить IK на ноги humanoid-персонажа
  • найти причину, по которой переход срабатывает с задержкой

Примеры запросов агенту

  • Собери Animator: Speed через SetFloat должен гнать blend tree idle/walk/run
  • Прыжок срабатывает с задержкой — проверь Has Exit Time на переходе в .controller
  • Добавь IK для левой руки в OnAnimatorIK и включи IK Pass на слое

Как установить unity-animation

1Через Skills CLI (Vercel)

npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill unity-animation -a claude-code

2Вручную: положить файлы

~/.claude/skills/unity-animation/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/unity-animation/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Из того же набора77

steam-publish Скилл ведёт релиз игры в Steam по шагам: депоты и пакеты, загрузка через steamcmd, ветки, чек-листы ревью. Нужен, когда билд готов, а магазин и релиз ещё нет. CX Codex +1 5 900установок itch-publish Скилл проводит сборку игры до страницы на itch.io: butler push в нужный канал, версии, обновление только изменённых файлов. Пригодится, когда пора выложить демо или релиз. CX Codex +1 5 700установок phaser-core Скилл для настройки и отладки игр на Phaser 4: конфиг Game, жизненный цикл Scene (init/preload/create/update), загрузчик ассетов, камеры и передача данных между сценами. Пригодится, когда вы пишете или чините Phaser-игру. CX Codex +1 5 700установок game-jam Помогает спланировать разработку игры под дедлайн геймджема: распределить часы, урезать лишние механики и подготовить релиз к отправке. CX Codex +1 5 700установок threejs-gltf-loading Загружает glTF и GLB в three.js и проигрывает запечённые клипы через AnimationMixer, включая сжатые DRACO, Meshopt и KTX2. Пригодится, когда модель вроде загрузилась, а на экране пусто. CX Codex +1 5 600установок unity-physics Помогает настроить 3D-физику в Unity 6.3 LTS: движение через Rigidbody, рейкасты, триггеры и слои коллизий. Пригодится при написании скриптов перемещения и проверок сцены. CX Codex +1 5 600установок roblox-datastores Учит агента сохранять данные игрока в Roblox через DataStoreService: загрузка на входе, сохранение на выходе и в BindToClose, ретраи. Пригодится, когда прогресс теряется. CX Codex +1 5 700установок unity-input-system Скилл для Claude Code, который настраивает ввод в Unity 6.3 LTS через Input System: action maps, PlayerInput, чтение значений в C#. CX Codex +1 5 700установок

Похожие

unity-package-management Unity-Technologies Управляет пакетами UPM из терминала через команды Pipeline или запасной C#-скрипт. Пригодится при настройке зависимостей Unity без открытия графического окна. CX Codex +1 7 300установок unity-pipeline Unity-Technologies Управляет активной сессией Unity Editor или тестовым билдом Player: запускает тесты, триггерит перекомпиляцию и меняет методы на лету. CX Codex +1 1 200установок unity Mindrally Скилл задаёт агенту правила игры в Unity: компонентная архитектура, ScriptableObjects, пулы объектов и работа с профайлером. CX Codex +1 908установок unity-game-developer davila7 Субагент для Claude, который берётся за Unity-проекты: скрипты на C#, физику, UI, оптимизацию под мобильные и сборку под разные платформы. 1 122установок unity-cursor-ai-c-cursorrules-prompt-file PatrickJS Правило для Cursor, которое настраивает ассистента на разработку игры на Unity с C#: модульный код, отзывчивые механики, производительность в реальном времени. ★ 41 011звёзд репо unity-developer rmyndharis Скилл для разработки игр на Unity 6 LTS с оптимизацией производительности, настройкой конвейеров рендеринга и кроссплатформной сборкой. Помогает писать C# код, настраивать URP/HDRP и решать проблемы с физикой и ассетами. CX Codex +1 3 000установок

Вопросы о unity-animation

Как установить unity-animation в Claude Code?

Выполните npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill unity-animation -a claude-code. Скилл окажется в ~/.claude/skills/unity-animation/SKILL.md.

Что делает unity-animation?

Показывает агенту, как связать клипы в стейт-машину и рулить ими из C#: параметры, blend trees, слои с Avatar Mask, IK. Заодно перечисляет типовые поломки вроде молчаливых опечаток в именах параметров.

Заработает ли IK на не-humanoid риге?

Нет. IK применяется только внутри OnAnimatorIK, требует включённого IK Pass на слое и Humanoid Avatar у модели.

Исходный текст

SKILL.md · Apache-2.0
---
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

```csharp
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

```csharp
// 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)

```csharp
// 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

```csharp
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

- **`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).
- **A cross-fade is much slower or faster than expected** — `CrossFade`'s duration is
  *normalized* to the state's length. Use `CrossFadeInFixedTime` to give the
  duration in seconds.
- **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.

© gamedev-skills · Apache-2.0 · gamedev-skills/awesome-gamedev-agent-skills

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой