Skip to content

t1k:unity:animation:core

FieldValue
Moduleanimation
Version2.2.2
Efforthigh
Tools

Keywords: animation, animator, clip, state machine, unity

/t1k:unity:animation:core

SystemUse When
MecanimCharacter locomotion, state machines, blend trees
Playable APIRuntime blending without AnimatorController, procedural animation
TimelineCinematic sequences, choreographed events, cutscenes
Animation RiggingIK (arm/leg), head tracking, weapon aiming (post-bake pose)
Animator anim = GetComponent<Animator>();
// Parameters
anim.SetBool("grounded", true);
anim.SetFloat("moveSpeed", 3.5f, dampTime: 0.1f, deltaTime: Time.deltaTime);
anim.SetTrigger("attack"); // call once per input event only
// Direct play (bypass FSM)
anim.CrossFade("RunState", duration: 0.2f);
anim.Play("IdleState", layer: 0, normalizedTime: 0f);
// Query
bool inRun = anim.GetCurrentAnimatorStateInfo(0).shortNameHash == Animator.StringToHash("Run");
float progress = anim.GetCurrentAnimatorStateInfo(0).normalizedTime;
// Layer blending
anim.SetLayerWeight(1, 0.5f); // upper-body overlay at 50%

→ See references/mecanim-guide.md for BlendTree types, root motion, AnimationEvents, StateMachineBehaviour, Animation Rigging IK, performance tips, and gotchas.

PlayableGraph graph = PlayableGraph.Create();
var mixer = AnimationMixerPlayable.Create(graph, 2);
graph.Connect(AnimationClipPlayable.Create(graph, clipWalk), 0, mixer, 0);
graph.Connect(AnimationClipPlayable.Create(graph, clipRun), 0, mixer, 1);
AnimationPlayableOutput.Create(graph, "Anim", animator).SetSourcePlayable(mixer);
graph.Play();
mixer.SetInputWeight(0, 0.7f);
mixer.SetInputWeight(1, 0.3f);
// CRITICAL: graph.Destroy() in OnDisable/OnDestroy

→ See references/playable-timeline-guide.md for full graph patterns, custom PlayableBehaviour, Timeline setup, SignalTrack events, runtime binding, and gotchas.

  1. Trigger auto-resetSetTrigger() resets after one frame; call once per input event
  2. Hash parameters — use Animator.StringToHash("name") for per-frame reads, not raw strings
  3. graph.Destroy() mandatory — leaks GPU/CPU resources if skipped
  4. Root motion conflict — disable NavMesh/CharacterController when applyRootMotion = true
  5. Animator.Rebind() expensive — avoid at runtime; Instantiate prefab instead
  6. Timeline vs Animator conflict — playing both simultaneously causes flickering; pause Animator when Timeline takes over
Assets/
├── Animations/
│ ├── Controllers/ # .controller assets
│ ├── Clips/ # .anim assets
│ ├── Rigging/ # RigBuilder, constraint prefabs
│ └── Behaviors/ # StateMachineBehaviour scripts
└── Timeline/ # .timeline assets
  • unity-cinemachine — Animation-driven cameras (Timeline)
  • unity-vfx-graph — Animation-triggered VFX
  • unity-input-system — Input-driven animation parameters
  • dots-graphics — ECS rendering (use dots-implementer agent)
FileContents
references/mecanim-guide.mdBlendTree types, root motion, AnimationEvents, StateMachineBehaviour, IK Rigging, performance, gotchas
references/playable-timeline-guide.mdPlayable graph, custom PlayableBehaviour, Timeline tracks, SignalTrack, runtime binding, gotchas