본문으로 건너뛰기
cccskills
무료GitHub에 공개

unity-animation

Connect character animations in Unity using Animator Controllers. Drive transitions from scripts, blend idle, walk, and run motions, layer upper-body actions over movement, and adjust humanoid hand or foot placement with inverse kinematics.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

원문원문 설명 보기

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.

실행 점수 미검증

설치 방법 보기

이럴 때 유용합니다

  • Blending idle, walk, and run animations
  • Triggering jump animations from scripts
  • Layering upper-body actions over movement
  • Adjusting humanoid hand and foot placement

포함된 파일(2)

  • SKILL.md5.5 KB
  • references/blend-trees-and-ik.md3.2 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

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.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Implement reusable decision systems for game characters using behavior trees, which organize conditional actions, and Utility AI, which scores available choices. Build either approach or combine them to control patrols, combat, targeting, and needs-based behavior.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Build a reusable behavior tree runtime
  • Choose attacks or targets using action scores
  • Combine patrol and combat trees with Utility AI
gamedev-skills/awesome-gamedev-agent-skills3.2천2026년 10월 23일 업데이트

Design game audio with grouped volume controls, music that responds to gameplay, and varied sound effects. Plan how music lowers during dialogue and how events follow the beat, using principles that can be adapted to different game engines.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Plan grouped volume controls for music, effects, and dialogue
  • Lower background music while dialogue plays
  • Change music layers or segments with gameplay intensity
gamedev-skills/awesome-gamedev-agent-skills3.2천2026년 10월 23일 업데이트

bevy-ecs

무료

Build and debug Rust games in Bevy using ECS, a way to separate game data from behavior. Organize apps and plugins, query entities, control execution order, and fix conflicting data access or frame-dependent movement.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Organizing a Bevy app with plugins
  • Defining components and shared resources
  • Fixing conflicting queries and execution order
gamedev-skills/awesome-gamedev-agent-skills3.2천2026년 10월 23일 업데이트

Build and tune game cameras for smooth 2D following and 3D viewing. Covers motion smoothing, look-ahead, level boundaries, wall avoidance, and framing multiple targets, with techniques that apply across engines.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Smooth player-follow cameras in 2D games
  • Keep the camera view within level boundaries
  • Prevent third-person cameras from clipping through walls
gamedev-skills/awesome-gamedev-agent-skills3.2천2026년 10월 23일 업데이트

card-game

무료

Design the core rules of a card game, including decks, hands, discards, drawing, shuffling, turns, and resource costs. Represent card effects as data and define their resolution order so card movement and gameplay outcomes follow explicit rules.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Building a deckbuilder or trading card game
  • Implementing draws and discard reshuffling
  • Defining turn phases and card costs
gamedev-skills/awesome-gamedev-agent-skills3.2천2026년 10월 23일 업데이트

Plan and prepare consistent game artwork, from sprites and backgrounds to UI icons and 3D briefs. Organize asset requirements, generate or source related visuals, standardize files, and check their appearance and technical fit inside the game.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Create sprites and backgrounds with a consistent visual style
  • Check asset dimensions, transparency, and tile seams
  • Track asset sources and licenses before release
gamedev-skills/awesome-gamedev-agent-skills3.2천2026년 10월 23일 업데이트

gamedev-skills의 스킬 모두 보기

이 스킬의 문제 신고