Using Animations in Unity

Eyas
8 min readFeb 4, 2023
Photo by Mélanie THESE

In solo game development, you can’t just stick to your strong suit. If you’re a Software Engineer trying out solo game development, being a solid developer will only get you so far; even if you’re using assets made by others, you’ll still need to know how to integrate them into your game tightly.

Animation is a great example. Imagine a character model has animations for walking, running, standing, talking, interacting, and more. In that case, you will still need to define how a character object triggers and transitions between these animations. These animations might also dictate what your object does; for example, an enemy that punches characters might want to deal damage at the precise moment the model’s arms are fully extended.

Today, we’ll discuss the essential concepts of using Animation in Unity. We’ll also go over a few examples using the incredibly cute Modular Animal Knights PBR asset pack from the Unity Asset Store. A free version that includes only the Dog is available here as well.

Concepts

Animation Clip

An Animation Clip (Animation for short, AnimationClip in code) is an asset that describes a series of keyframes for each property on a Game Object over time.

In other words, an Animation Clip asset describes, for a given Object, the change over time of any number of properties on that object. An Animation Clip can control any property on a Game Object or recursively accessible from a Game Object or any child object.

An Animation Clip has its own Animation Clip Editor Window. Here is an example Animation (from the animal knights pack) of an animation in its editor window, with the corresponding Inspector Editor for that animation docked next to it.

In addition to an Animation Clip specifying properties on a Game Object, a clip can control Animation Avatar properties. An Animation Avatar is an asset that defines the relationship between a standard “skeleton” set of transforms (head, chest, leg, etc.) to a specific model. See the Character Animation tutorial on Unity Learn for more details.

For example, in the above screenshot, the “Dog Knight” model comes with an Avatar asset that defines the relationships between . The animations included in the asset pack control the avatar transforms. Prefabs included in the asset pack will point to an…

--

--

Eyas

Software Engineer living in Brooklyn, NY. MIT Computer Science S.B. ’13, M.Eng. ‘14. From Amman, Jordan. Interested in politics, current affairs, and technology