Cinematography in Unity

Michael Hatfield
4 min readApr 25, 2021

--

Introduction to Timeline and Cinemachine in Unity Part 2

In yesterday’s article, we covered how Timeline and Cinemachine can be used to make cutscenes for your game. Today we will continue building the sleeping guard cutscene and show how to create cuts, play animations, and move the virtual cameras using Timeline.

Looking back at the director’s notes, the first thing we need to have happen is a fade in to Darren sneaking up to take the key card from the sleeping guard.

First image from the director’s notes.

We have the scene blocked and ready to go so we can open a Timeline window and begin working on the cutscene. Make sure you have the highest level of the Sleeping Guard Cutscene game object selected and then create a timeline by selecting Window/Sequencing/Timeline from the Unity main menu. This will open a window you can dock in Unity just like any other and add the Playable Director Component to the SGC game object. Click CREAT in the Timeline window and save the timeline with a meaningful name.

Unity editor layout while using Timeline

Once you have the Timeline component added to the game object, you might want to rearrange your editor layout to allow you to see the Scene view, Game view, and Timeline all at the same time. This will make building the Timeline much easier.

Adding a virtual camera

In the Timeline window, change the settings to work in seconds instead of frames. Our cutscene will be around 5 seconds. Next, add a Cinemachine.Timeline / Cinemachine Track and drag in the Main Camera.

In the right side of the Timeline window under the actual time line, right-click and select Add Cinemachine Shot Clip and make sure it starts at 0 seconds. Then, in the Inspector, Drag and drop the OTS (over the shoulder) virtual camera into the Virtual Camera slot.

Adding in our first shot.

Next, repeat the process for the Mid shot. If you adjust the shots so that they overlap slightly in the timeline, you can create some pretty nice effects as the view changes from the first virtual camera view to the second one.

A very rough draft so far.

For the first part of the cutscene, we need to pan up while looking over Darren’s shoulder. To do this we need to add an Animation Track to the Timeline. Using the record option for the Animation Track we added, you can set the virtual camera’s starting and ending positions.

Unity Timeline will handle all of the work and calculations needed to move the virtual camera from its starting position to it s final position. You can move the camera along one or more of the axises or rotate it in any direction. All you have to set are the two key frames for a smooth transition.

Here is how this cutscene looks so far:

This first part looks pretty good but could use some small adjustments.

In the second part of the cutscene, we need to focus in on the keycard and then pan up to show Darren’s face after he takes the card. We also need to make changes to the keycard game object as it is being taken by simply turned it off in the game view. We can do all of this and more in the Timeline we have built.

But for today, I’m good with the results so far. Tomorrow we will finish this cutscene and set up a fade-in/out sequence. It will then be ready to drop into the game at the appropriate spot. See you there!

--

--

Michael Hatfield
Michael Hatfield

Written by Michael Hatfield

IT Specialist / Indie game developer

Responses (1)