Working with Timeline
Timeline is another aspect to Cinemachine, although it is bundle when you add the Cinemachine asset, the Timeline system can be use independently from Cinemachine Virtual Cameras. Timeline is non-linear therefore you are able to create or add animation and readjust where they belong on the dopesheet.
How to Setup the Timeline:
The Timeline window can be brought out by going to Windows > Sequencing > Timeline.
This will bring out the Timeline window, which is very similar to the Animation window.
In order to start working with timeline, we need to create a new empty game object in the Hierarchy which will house the Playable Director. An Playable Director is an component that houses the settings for the Timeline. We can have multiple different Directors each controlling different Timelines.
(An Example would be having two cut scenes, each cutscene would be contained within an individual Playable Director.)
Once you have an null game object in the Hierarchy we can create a new Timeline by selecting the Create button on the Timeline window. This will prompt you to save the timeline somewhere in the assets folder, I strongly recommend using an new folder with an identifiable name to save all the playable directors in.
Once you have created a proper saved place, the Timeline would automatically add an Playable Directed to the null game object, and the Timeline window will be updated with a new dopesheet.
Underestanding the Playable Director:
We are going to go over some of the settings within the Playable Director before we start with the Timeline. As stated above, the Playable Director has full control over the Timeline, as such they can be setup to adjust the Update Method. If your game requires a time freeze or time slow down, and you want the cutscene/timeline to still play in normal speed, then this is where “Unscaled Game Time” or “Manual” would be setup. “DSP Clock” can be used to match the timeline speed to follow the Audio Clips duration.
Play on Awake Mode allows the Timeline to automatically play once the Game Object that the Playable Director is located in is set to active. If it isn’t active, then you will have to manually toggle the Timeline via script.
Wrap Mode is basically telling the Timeline to either repeat itself, or Hold position of the last frame, or do nothing at all once the Timeline has finished its duration.
Initial Time is the duration the Playable Director is going to wait before the Timeline will start playing.
Bindings is an list of game objects that are currently involved with this timeline. This is a nice quick look at all the components within this active Timeline.
Understanding Timeline UI:
In the Timeline, you will noticed that there are a few UI components like the Animation window. Just like the Animation window, on the right top bar of the window you see a gear icon which is a drop down menu which gains access to how the timeline is align by, either Frames or Second.
You are also able to adjust the Frame Rate of the Timeline, although default (Film 60) or (Film 30) is the standard setting.
On the Left top side of the Timeline, you will see a “+” icon, this will bring out a list of different Track types you can add to the Timeline. We will go over each individual Track in an later article.
For now if you wish to add game objects into the track, we can do the simplified method which is to drag and drop that game object into the Timeline itself.
Once you do, Timeline would prompt what type of track this game object will use. You will have 4 options.
An Activation Track allows the object to be toggled active or not. An Animation Track is what allows you to add an Animator to your game object and also animate it. The Audio track is only for Audio Clips and Signal Track is an ability to toggle systems outside the timeline. (say you want to trigger a scene change after a certain cutscene, adding an Signal Track at the end of the Timeline would do that)
Just like the Animator, you are able to do recordings of the object if your object is using an Animation track. By clicking the Record button (the red dot) you will see that the entire track turns red, and you are able to record any movement your object does.
You can also refine the position of the frames by double clicking the recorded track in the timeline. This will open up the Animation window and you will be able to freely adjust the timing and frame position on the dopesheet. These changes will also be reflected back in the Timeline.
A nice function you can use while working with the Timeline is that you can add in and ease in and out ability by holding “Control” button and dragging the corners of the timeline track. This will create a tilt in the track visualizing how much the ease in or out will be. Of course this will also be shown in the Inspector when you select the active track in the timeline.
One final tip that can be applied to the Animation Track, is that you can create multiple animations of the same object in one Timeline. If you move the scrubber to the end of your current recorded track and add click the record button again, you will be able to add another recorded track beside the current one. This way you can add several animation to one game object.
An example of that being using in practical method would be having a cutscene of an NPC doing different motions (happy, sad, angry).