Animate GameObjects using Timeline in Unity3D

When using 3D objects to compose cinematic cut scenes, it is important to be able to preview animations in real time while editing. This article shows how to quickly get your animations previewing using Timeline and Cinemachine.

In this scene, I have the protagonist Darren opening a door to exit after completing his mission objective. This is a 3D model with an attached animation, so I begin by dragging the prefab into the scene view and positioning it where the scene takes place.

I press the play button to start the game and preview the animation, which is entirely what I want to avoid by writing this article. It’s much more efficient to be able to preview and scrub through the scene using Timeline rather than starting and stopping the game repeatedly.

Darren and his corresponding animation in the hierarchy are located in this Win Level Actors prefab.

I create a new Cinemachine virtual camera to begin composing my shot.

I can use the scene view to compose the camera shot, and then with the virtual camera selected in the hierarchy, the composed shot can be transposed to the virtual camera by pressing shift+ctrl+F.

With the Win Level Cutscene prefab selected in the hierarchy, I create a new playable timeline.

The file will need a new name and a location with it’s other playable file types.

Returning to Timeline now, a new animation track is added.

The object I want to preview the animation on is the Win Level Actors prefab, so I drag that from the hierarchy, into the animation track to assign it.

The small hamburger/3 bars icon can be pressed, and the selection I am looking for is Add From Animation Clip. This will pull up all available animations to assign by name, all I need to do is find it and select it. In this case it is the End Level Cutscene animation.

The animation is now assigned, can be previewed with the play button in Timeline, or scrubbed through by dragging the cursor.

That was the main objective of this article, but I am going to finish up this cutscene anyways. I drag the main camera into the timeline to create a new cinemachine virtual camera track.

A cinemachine shot clip is added to hold my first virtual camera.

With the shot clip selected, the desired camera can be dragged into the inspector to assign it.

I add a second camera to get a close up shot to transition to.

Another cinemachine shot clip is created, and the new close up camera is assigned.

This positioning of the shot clip will provide a hard cut, but that’s not what I want with this shot.

The close up shot clip can be dragged over the rear view shot clip to make a transition. In this case I have a fairly long blend shot, moving from the first camera to the second.

Here is what that looks like.

Let’s add a little natural movement, like as if there were an actual person holding a camera. With the rear view camera selected, the inspector shows a noise option. I choose Basic Multi Channel Perlin from the drop-down.

The small round button is pressed to bring up some presets. I choose the Handheld normal mild option.

Here is that clip again, only with a little natural camera shake.

I want to fade in and out from black, as well as doing the same with some buttons and text elements. Two animation tracks are added, one for the camera fade, and another for a canvas housing the UI buttons and Text Image.

The small record button is pressed to begin tracking the animation.

All that is needed, is to position the cursor at the right places in the timeline, and then change the alpha channel on the canvas and the camera fade.

Here is the final cutscene. Thanks for reading!