Introduction to Unity Timeline

Games often use cutscenes to engage the player and tell parts of the story. The Unity Timeline allows you to harness your in-engine assets to create highly customized cutscenes. By Anthony Uccello.

Leave a rating/review
Download materials
Save for later

Developers often use cutscenes to tell parts of a game’s story and engage the player. Some games use specially pre-rendered animated scenes with higher detail models, while others use the actual in-game models. Using in-game models can be a great cost and time saver to you because you don’t need to make new models, rigs and animations just for cutscene story moments. And just because you’re repurposing your existing assets doesn’t mean that you need to skip the special effects or drama! Unity has a rich tool to help you make engaging cutscenes — the Unity Timeline!

In this tutorial, you’ll learn about Timeline and how to make cutscenes with animations and camera changes.

Getting Started

Download the starter and final projects using the “Download Materials” link at the top or bottom of this tutorial.

Open the Starter Project file and load the Main scene. This is your starting point. It features the hero standing on the tower looking out into the world:

With your help, he will leap off of the tower, turn, walk towards the treasure chest and then kick open the chest. The camera will also take on new positions throughout these animations. Here is what the final scene will look like:

What Exactly Is a Timeline?

You will accomplish this tutorial using Unity Timeline — but what is a timeline? A timeline is a literal GameObject with a timeline component, which is editable in the Unity Timeline window that controls the animation keyframes and object life cycles. When you are making a cutscene with Unity Timeline, you are setting all the animation keys you will use, as well as determining when they need to fire. For this tutorial, you will also use AnimationController, which can be thought of as a super-set of animation keyframes.

Whenever a character performs an animation, such as walking, every single vertex on the object that moves needs to have it’s path mapped out. You won’t be worrying about creating model and rig animations in this tutorial — it’s already done for you. But it’s helpful to know that, whether you are manually setting an animation keyframe or using an AnimationController animation, they are all basically the same thing: The position of objects at a given moment in time. A timeline is the conductor that coordinates all of these movements to create a scene. This will all make sense as you dive into using Unity Timeline.

Before diving deeper, it’s helpful to get an overview of the Timeline window. See the image below and the corresponding numbered descriptions:

  1. Timeline Asset: This is a track that is linked to a GameObject that exists in the hierarchy. It will store keyframes associated with that GameObject in order to perform animations or determine whether the GameObject is active.
  2. Associated GameObject: This is the GameObject that the track is linked to.
  3. Frame: This is the current frame in the timeline that has been set. When you want to change animations, you will set the keyframes at the starting and ending frames.
  4. Track Group: As scenes grow, so will the number of tracks. By grouping tracks, you can keep your tracks organized.
  5. Record Button: When this is active, you can change the current frame and set the position and/or rotation of the GameObject in the scene, and it will record the changes.
  6. Curves Icon: Clicking this will open the Curves view to give you the finer details on the associated animation keyframes so that you can adjust them as needed.

Don’t worry if that felt like a lot to take in at once — you’ll revisit the above during the tutorial. The most important thing to know, at this stage, is where the Timeline window is and that, by selecting the Timeline GameObject, you can access the Timeline window.

Lights, Camera, ACTION!

With the main scene loaded, press Play. You should see the hero idling on top of the tower:

This is the default animation set in the Animation controller. This tutorial will leverage animations that have already been set up for you, and you won’t need to worry about the inner workings of models, animations or controllers. But if you want to learn about that process you can take a look at our Introduction to Unity Animation tutorial.

Creating the Timeline GameObject

The first step is to create the Timeline GameObject. Create an empty GameObject by right-clicking (Command-clicking on a Mac) the Hierarchy window and selecting Create Empty. This will add a GameObject to the scene and select it:

With the GameObject still selected, open the Window menu and select Timeline. This opens the Timeline window. Click the Create button and it will open up a Save dialog box. Rename the file to Timeline and click Save:

Rename the GameObject to Timeline by clicking it, pressing F2 and typing in Timeline:

You’ve now created the Timeline GameObject that will coordinate all the animations and camera changes for the cutscene. Under the hood, Unity has saved an Asset file called Timeline.playable to disk. On the Timeline GameObject, Unity added the Playable Director and Animator components.

The Playable Director component contains the Playable field that is bound to the Timeline asset that you’ve just saved. The Animator component that Unity added would, in theory, allow you to animate the Timeline GameObject, but you won’t be doing that, so you can just ignore this.

Before moving on, you’ll want to drag the Timeline tab to the bottom of the screen. This will allow you to have the Scene and Timeline windows open at the same time:

Select the Timeline GameObject and return to the Timeline window. Right now, there is an Animation Track for the Timeline GameObject. This won’t be needed, so you can select it and press Delete to remove it:

Animating the Jump!

You are now ready to animate. Expand the Hero GameObject to reveal the ModelGameObject. Select the Timeline GameObject. Drag the Model GameObject onto the Timeline window; this will prompt you to select a track so select Animation Track. Repeat this step for the Hero GameObject:

Note: The reason you added both the Hero and Model GameObjects has to do with making sure animations will properly zero to local space. The Hero GameObject is a container for the Model GameObject, which allows the animations to play without interfering with the position from where they are playing. Whenever you need to move the hero, you will be animating the Hero GameObject. When the hero needs to animate — which it can do while moving, too — you will use the Model GameObject. Without this parent-child relationship, the animations that the Model will play would incorrectly override the Hero GameObject movement settings if you didn’t properly set it as a child.