Objective: Use Timeline to set up cutscene in Unity
Timeline is for piecing together cutscenes, cinematic and game-play sequences, audio sequences, and particle effect sequences.
In the example below from “The Great Fleece”, we need to put together an animation timeline based on the virtual cameras we created in a previous article that coordinate with a premade cutscene animation for when the player steals a keycard from a sleeping guard.
We can start by selecting an empty game object that holds all the cameras and cutscene animation, and under the Timeline window we can create a new timeline.
The first item we want to add is a Cinemachine Track. This requires a Cinemachine Brain Component for switching among different virtual cameras, which our Main Camera already has. We can then add the different camera views from virtual cameras that focus on the key parts of the animated sequence.
To simplify the timeline, we can work in seconds instead of frames.
The first part of the cutscene focuses on one view of the player sneaking up to the sleeping guard, with the camera located behind the player and looking over his shoulder.
Simply dropping in the over the shoulder shot lasts 5 seconds. We can reduce that duration to better fit the first part of the cutscene by dragging the end of the segment.
We can right-click in the timeline to add another Cinemachine shot.
We can then drag the ends of camera shot to better fit with the rest of the premade animation sequence.
You can scroll through the virtual camera shots in the timeline view to see how the cameras transition.
Depending on the types of animations and goals you are trying to achieve, there’s an option to blend the two virtual camera shots that you can consider for your Timeline events. Simply by dragging one camera shot into the other creates a blend transition.
The next part of the Timeline creation is to add in the premade animation event that makes up the cutscene and coordinates with the camera changes.
The prefab animation has several animation components, so you need to right-click and add the specific animation clip.
Now we need to add a camera animation based on the Previs Elements, that pans over the shoulder (OTS) of the player in the first part of the cutscene.
At the 0:00 mark, re-type in the x-position of the virtual camera. This will set a keyframe to record the initial position. Then drag the timeline to around 2.50 seconds, just before the virtual camera change. Now move the virtual camera OTS to a new position that follows the shoulder (y-position and z-position, and rotation if you choose). Once you are satisfied with the panned camera position, you can press the record button again to stop recording.
If you would like to change the animation, you can simply delete the shot in Timeline, or alternatively, you can select the three dots on the right of the animation component and select to “Edit in Animation Window.”
This way, you can make additional refinements to the already created keyframes, such as adding additional zoom in effects and/or camera rotation.
The next part of the cutscene will have the camera focus on the player, then pan and look at the keycard, and then back up at the player as he successfully took the keycard. This sequence is detailed in a previous article on Previs Elements.
The next part of the Timeline is to show that the keycard disappears after the player steals it.
We can add a new “Activation Track” which shows game objects active for a specific part of the timeline.
Here’s the updated cutscene where the keycard disappears.
The last part of the Timeline for this cutscene is to add a fade in effect at the beginning of the cutscene. The fade in effect is described in a previous article about Previs Elements.
To implement, we show the black screen at the start of the cutscene and record a keyframe, and then after about 0.5 seconds, we set the alpha to transparent, and record another keyframe.
Finally, here is the completed cutscene.
Thank you for your time!