Unity Term Book
Animation & UI

Animation Clip

An Animation Clip is the basic unit of animation — a sequence of keyframes that change properties (position, rotation, color) over time on one or more objects.

Imagine...

An Animation Clip is a strip of film from a traditional animator. They draw the important keyframes (start of jump, apex, landing), then the software interpolates the in-betweens. The clip is that set of keyframes — "at 0.0s the hand is at A; at 0.5s at B; at 1.0s back to A". Unity reads the clip and updates GameObject properties every frame.

The concept in detail

An Animation Clip is an asset (.anim) that stores animation as curves per property — a Binding (property path on a component) plus an AnimationCurve (keyframes with tangents). You can animate any serializable property: Transform position/rotation/scale, Material color, float, bool, sprite, even a prefab reference.

Each Keyframe has a value and two tangents (in/out) that shape the Bezier between keys. Common interpolation: Smooth (auto tangents), Linear (straight between frames), Constant (hold until the next key — sprite flipbooks). A clip has wrapMode: Loop, PingPong, ClampForever, Once.

Clips come from two sources: Created in Unity (Animation window, record mode) or Imported from FBX (Unity splits clips from the file). On a Humanoid rig, clips use the Muscle system (normalized bones) and can retarget to another skeleton. Generic rigs bind to local bone paths.

Animation Events are powerful: drop a marker at a time in the clip; when the Animator reaches it, a C# method on a component fires. Use it for footstep audio, spawn FX, or a combo window.

Anatomy of an Animation Clip

Property
0.0s0.25s0.5s0.75s1.0s
Position.x
Position.y
Rotation.z
Scale
🔔 Events

FootStep

FootStep

Playhead:0.00s

Hands-on steps

1

Open the Animation Window

Window → Animation → Animation. Select a GameObject → create a new clip or pick an existing one from the dropdown.

2

Record keyframes

Press Record (red circle) → move the playhead → change a property in Scene/Inspector → Unity writes a keyframe.

3

Adjust tangents

In Curve view → right-click a keyframe → Free/Flat/Linear/Constant tangent to shape the curve.

4

Add Animation Events

On the Timeline bar → right-click → Add Animation Event → type the method name. The method must exist on a component of the GameObject.

5

Configure Loop and WrapMode

Select the Animation Clip asset → Inspector → Loop Time, Loop Pose (blend start/end). Enable Loop Pose for locomotion so it does not hitch.

Interactive simulator

Preview an Animation Clip with different interpolation modes — pick an easing to see the difference.

CURVE PREVIEW

Time: 0.00sValue: 0.00Easing: Smooth

Code example

Basic

Build an Animation Clip from code with AnimationCurve.

using UnityEngine;

public class ProceduralClip : MonoBehaviour
{
  void Start()
  {
      AnimationClip clip = new AnimationClip();
      clip.legacy = true; // Use with Animation (not Animator)

      // Curve: jump up then land in 1 second
      AnimationCurve curve = new AnimationCurve(
          new Keyframe(0f,   0f),    // t=0: position 0
          new Keyframe(0.5f, 3f),    // t=0.5: peak at 3
          new Keyframe(1f,   0f)     // t=1.0: back to 0
      );

      // Bind the curve to transform "localPosition.y"
      clip.SetCurve("", typeof(Transform),
          "localPosition.y", curve);

      // Play with the legacy Animation component
      Animation anim = gameObject.AddComponent<Animation>();
      anim.AddClip(clip, "jump");
      anim.Play("jump");
  }
}

Code example

Advanced

Handle Animation Events from code — footsteps and combo windows.

using UnityEngine;

public class AnimationEventHandler : MonoBehaviour
{
  public AudioClip[] footstepSounds;
  AudioSource audioSrc;

  void Awake() => audioSrc = GetComponent<AudioSource>();

  // Called by an Animation Event when a foot hits the ground
  // (Method name must match the Event in the editor)
  void OnFootstep(AnimationEvent ev)
  {
      // ev.intParameter: 0 = left foot, 1 = right foot
      int foot = ev.intParameter;
      AudioClip sound = footstepSounds[
          Random.Range(0, footstepSounds.Length)];
      audioSrc.PlayOneShot(sound, 0.7f + foot * 0.1f);
  }

  // Callback when the combo window opens (set in the Attack clip)
  void OnComboWindowOpen()
  {
      Debug.Log("Combo window open!");
  }
}

📌 Quick recap

  • A clip = AnimationCurves bound to property paths
  • A Keyframe has value + in/out tangents for easing
  • Animation Events: timed callbacks inside a clip
  • Loop Pose: blend start/end for a seamless loop
  • Humanoid clips retarget; Generic clips bind to a specific skeleton

⚠️ Common mistakes

  • ❌ The Animation Event never fires

    The Event method name does not match a method on a component, or the component is on the wrong GameObject

    ✅ Match the method name exactly (case-sensitive) and the receiver GameObject

  • ❌ A looping clip hitching at the seam

    First and last keyframe values do not match

    ✅ Enable "Loop Pose" and keep root motion even