We’ve seen primitives, and more complex objects like ships animated in Timeline, but the most complex object yet is a character. Characters tend to have a variety of expressions, actions, and states that make them truly unique to explore when it comes to animation. Getting started might sound intimidating, but let’s dive in step by step.
Note: There is a tendency to dive into characters as soon as you get started with Timeline — I mean why wouldn’t you when they’re so interesting? My advice is to build up to it and start with less complex objects first. That way you’re already acclimated with Timeline by the time you get to the more complicated aspects.You can catch up all my Cinemachine and Timeline articles here.
Objective: Learn how to add, edit and use character animations in Timeline.
Table of Contents
· Setting Up
∘ Creating your Timeline
∘ Humanoid Animation Type
∘ Working With Imported Animations
· Adding Character Animations in Timeline
∘ Smoothly Transitioning between Animations
∘ Matching Clip Offsets
· The Result
Let’s make sure everything is set up before we start adding things to Timeline.
Creating your Timeline
- Create an Empty Game Object, this will hold your Timeline and Director.
Make your character into a child of the Timeline Empty Object, this is a way to keep track of what is being controlled by Timeline.
2. Select your Timeline object and create a Director in your Timeline window. This should be saved to a dedicated folder in your assets, a folder preferably titled “Directors” to keep everything clean.
Humanoid Animation Type
Make sure that all your character animations are set to Humanoid, that way Unity will know to use Mecanim for your animations— you don’t need to worry about using Mecanim yourself.
3. Select your animation → Inspector → Animation Type → Humanoid
This process must be repeated per animation.
Working With Imported Animations
Whether you got your animations from the asset store or another 3rd party, you will need to duplicate your animation in order to use it. This is because imported animations are write-protected which impedes certain things like Events or Timeline usage.
4. All you need to do is Select your animation object and find the actual animation within it.
You can recognize an animation by this triangle shape.
5. After you duplicated the animation, make sure to rename it to the animation you want.
This is all the setup needed to get started now let’s dive in!
Adding Character Animations in Timeline
- Drag and drop your character into Timeline. This will prompt you to select a track type; choose Animation Track.
2. Drag and drop animations to your animation track. This might make your Character position change, but you can simply reposition them.
When you press play, your animation should start.
Smoothly Transitioning between Animations
1. Let’s add a different animation, you will quickly notice one of the advantages of Timeline.
When you play your sequence after adding a different animation, you might notice that there’s an awkward jump between the two.
2. This can be easily fixed by just dragging the second animation to overlap with the first — this is how you manually add an ease in effect.
Now let’s take a look at that sequence again. Smooth right?
You can even add more than one punch animation and then go back to the idle animation or whichever starting and second animations you chose.
Matching Clip Offsets
When adding different animations, you might run into animations that change the rotation of your characters, so adding ease in or ease out won’t fix the jerkiness of the movements between clips.
In this case, we match clip offsets, this makes it so the starting clip applies the positional offset of the one previous to it. Let’s have a look at that.
Here I added another animation that has the character turn right, it’s transitioning smoothly, and so far this is a smooth transition.
But what if we added another animation after the rotation has changed? You can see that even with an ease-in, the movement is jerky at best.
To fix this: Right-click on the animation → Match Offset to Previous Clip.
Now, your character should keep moving in the rotational direction applied from the previous clip. No unnatural jerky movements.
Here’s the full animation sequence