Esteban Ibarra

May 28, 2021

4 min read

Introduction to the Timeline in Unity

This week, I’m learning about putting together a cutscene in Unity. In order to make that happen, we need two parts: Cinemachine and Timeline.

Cinemachine is Unitys new dynamic camera system, it helps you easily create cinematic shots through various virtual cameras.

Timeline is an animation track that allows you to animate any kind of event. If it’s on the screen, Timeline can record and modify it!

Combined together, you have a powerful system that can both time camera cuts as well as animate camera pans, zooms, and dollys. Timeline is incredibly easy to work with, and I’m excited at the possibilities of it for future projects, but for now, I’ll demonstrate how easy it is:

In Unity 2020, open Window, Sequence, Timeline.

Normally, we'd have to create an Empty with a playable director We’ll be going deeper into composing a scene with cameras later, but for now, let’s dip our toe into using the timeline and create a virtual camera by going to Cinemachine/Virtual Camera:

Let’s move the camera to an interesting position, as a shortcut, we can set the view ourselves and hit ctrl-shift-f to set the camera to the same position:

Now we’ll do a simple pan using the timeline. Select the camera and in the timeline, you’ll see a message offering to begin a new timeline. If you remember creating a sprite with Galaxy shooter, it’s absolutely the same process. Press the button, go to the folder you wish to save the animation to, and create the animation.

We’re almost ready to animate! The timeline offers various tracks to help you create movements in Unity, let’s go over each one:

Types of Animation tracks:

Activation Track: Controls the activation or inactivity of an object. Basically, you can turn gameObjects on and off with it.

Animation Track: This allows the recording of an object's movement, rotation, scale, etc. of gameObjects and their elements.

Audio Track: We can import audio clips like dialogue, sound effects, etc.

Control Track: Let’s you take control of time-related elements of a game object. Like control another playable director or modify particles over time.

Signal Track: These work similar to events and broadcast a signal that another playing animation may subscribe and react to.

Playable Track: According to Unity, a playable track is a track that can contain PlayableAssets that are found in the project and do not have their own specified track type.

Cinemachine Timeline: This is the track that controls activation of Cinemachines virtual cameras

Since we want to animate our camera, let’s create an animation track:

Now we’re ready to animate! Hit the record button and on frame 0, make a slight adjustment to the camera and then reset it to set the first keyframe, then move up a few seconds and move the camera wherever you like. Hit the record button again to turn it off. Congratulations! You’re now an animator!

let’s see the animation in action, you can either ‘scrub’ the timeline or hit play to see the animation play and camera pan:

This is but a brief introduction to the timeline, but I hope it’s whetted your appetite to learn more about it, and we’ll be doing that in future articles! Tomorrow we’ll talk about working with previsualization elements.