Intro To Timeline In Unity
Timeline is a Unity feature designed to easily create a timeline of multiple events that will happen in a set sequence over the duration of the timeline.
Finding it in Unity:
You will find the Timeline window under “Window > Sequencing > Timeline”
This will open a new editor window like so:
Setting up the Timeline:
Unity’s Timeline feature works on any GameObject in your scene, and requires a “Playable Director” component.
You can add this component manually through “Add Component”, or use the Timeline window by selecting the GameObject then clicking “Create”.
If you click “Create”, you’ll be asked to choose where to save the new “*.playable” file which (like an Animation Controller) is a Project Files file which is referenced by the Playable Director. This will automatically fill the “Playable” variable on the Playable Director with the new file.
Using the Timeline:
Once the GameObject holding the Playable Director is selected, and the Timeline is usable, you can start adding things to the sequence.
There are many different types of elements you can add to the Timeline. A “Track” is just a name for an element in the Timeline’s sequence.
Activation Track: This can Enable or Disable a specific GameObject at any time in the Timeline.
Animation Track: This holds an animation for a single GameObject which will run during the sequence. The animation can be from a saved Animation file, or an animation that only exists within this Timeline.
Audio Track: Similar to the Animation Track, this is a single audio file which will play during the sequence.
Cinemachine Track: If you have Cinemachine installed in your project, you can create a track to control the camera behaviour during the sequence.
I’ll skip the others.
In this example, I use a Cinemachine Track, a Activation Track, and 4 Animation Tracks to create a short cutscene for a stealth thief game I’m making.