Timeline in Unity
Timeline is a great way for making cutscenes in your game. I will show you how to get started with using a timeline editor.
First, we need to go to Window -> Sequencing -> Timeline to open Timeline Editor.
We need to create a Timeline asset that will store all the data about our cutscene. To do this create an empty GameObject and click on Create in Timeline Editor. There will be two components created in your empty GameObject, Playable Director and Animator. Playable Director let’s you choose e.g. if you want to start your cutscene as the game starts or if to loop your cutscene once it’s done. The Animator compoenent is created because Unity assumes that you will be animating this GameObject. Delete it. Also, delete the component that appeared on the Timeline.
To use Cinemachine in our Timeline we need to add the Cinemachinne Brain to it. Click on the plus to add Cinemachine Track in the Timeline Editor.
Drag the Main Camera to the slot. Now, we can swap between virtual cameras. Before adding any virtual cameras, change frames to seconds to make creating the cutscene easier.
To add a virtual camera to the Timeline just drag it from the Inspector. To change the length of the clip just drag it.
You can add another virtual camera.
You can also blend between tracks.
There is a lot of other things you can do with the Timeline. You can add Audioclip to play at the certain time or enable/disable GameObjects. You can also animate GameObjects directly in the Timeline Editor.