Animate GameObjects using Timeline

Now that we know how to use virtual cameras and Dolly Track in the Timeline, it’s time to learn how to animate GameObjects.

Let’s see the director's notes for the next cutscene:

In the previous articles, we learned how to animate actors and virtual cameras, so I won’t be showing how to do this for this cutscene. Right now, we have two virtual cameras and an animation of Darren. What we need now is to make a fade-in at the beginning of the cutscene.

Right-click on the Hierarchy window, go to UI, and select Image. Call it “Fade Camera”. Change the color to black. Change the anchor and change the Left, Right, Top and Bottom to 0. Now the screen in your Game window should be black.

The last thing you need to do is go to your Canvas and set Scale Made to “Scale with screen size”.

We are ready to animate.

Go to your Timeline, click Add ->Animation Track. A new track will be created. Drop there the Canvas GameObject.

Click on the red button to begin animating. The track on the Timeline should change to red, and there should be a “Recording…” text on the track.

We want to use the transparent channel on the Fade Camera image to start the cutscene.

Make sure that you are on the first frame.

Go to Fade Camera image, click on the Color and change the value so a keyframe will be created on the Timeline.

Now go to about 35 seconds on the Timeline and change the color of the transparent channel to 0.

We have an animation!

This way, you can animate any GameObject. For example, you can animate their position, rotation, scale, color on a material, or even the position of the virtual camera on the Dolly Track we made in the previous article.