Sometimes in video games, predetermined (scripted) events are desired for certain moments, allowing for finer control over the presentation. These can be used for scripted cinematics in the game where control is taken away from the player. They can also be useful for making game trailers, which was done 2 weeks ago. In this little walkthrough, we’re going to go over some of the process in using the built-in Timeline functionality in the Unity 2017 game engine.
The first thing to do is to open up the Timeline window under Windows>>Timeline Editor. When that is visible, you can select any object in the scene hierarchy and click Create in the Timeline window. This will add a Director component to that object and have you create a new Timeline asset.
On the top of the Timeline window is the actual timeline where 0 is the start of the event, which can be triggered to occur at a certain time or start on awake.
To have something happen to the object during the event, you have to add a key frame somewhere in the timeline. To start, click the red record button next to the object you want to add a frame to.
Next, make sure that object is selected in the scene hierarchy, right click (almost) any property in the inspector, and click Add Key. This will record the data of that property for this key frame.
You can then click any other spot in the timeline and add another key for some property to have it change over time.
If you click and drag across the timeline, you can preview what the transition will look like in the scene view.
If you click the red record button again to make it stop recording, you can preview the transition curves by clicking the box right next to that red button. You can change the curves by right clicking the points and messing with the tangents to the left and right.
You can also add more objects to this timeline by dragging and dropping them from the scene hierarchy to the Timeline window and selecting Animation Track.
As an example of what’s possible with timelines, below is a shot from the recent teaser trailer. It only involves a camera moving from one position to another and a sprite changing opacity (the floating black squares are an added particle effect).
We hope this gave a decent overview of using Unity’s Timelines. It’s a very useful tool for all sorts of game moments. Until next time.
-Behind You