Combining Cinemachine and Timeline in Unity
Objective: Use the virtual cameras created in the last article to create a small cutscene test
If you have read the previous article on creating virtual cameras using Cinemachine then carry on reading. Otherwise, I recommend you read that first and then come back to this article.
Above you can see the end product of a simple Timeline animation using two virtual cameras and blending between them
You need to open the Timeline window which can be accessed through the Window tab -> sequencing -> TimeLine. This can be in a different place depending on the Unity version.
Now you need to click on an empty game object or the object you want the cutscene to be on. I have a dedicated gameObejct for this small scene. Make sure the timeline window is open and you can see both the object and the window. You should see the below:
Click create, name and save the asset like an animation. You will now see a panel that is similar to the animation window. Now right-click in the panel and click Cinemachine.Timeline -> Cinemachine track. This will give you an empty slot that needs filling. Drag and drop your main camera into the empty slot. This will be your Cinemachine brain.
You have two options on the next steps, you can right-click and add Cinemachine shot. You then need to drag in the virtual camera you want into the slot in the inspector. Or you can drag and drop your virtual camera into the timeline.
You can make the camera shot last as long as you want by dragging the side of the shot. I have set mine to 2 seconds. Then I dragged my second shot into the timeline.
Now comes the really interesting part, blending the two shots together. When you do this it will automatically move between the two cameras when the timeline is played. Drag the second shot over the first and you will see a diagonal appear, that is the blending time.
And that is it for creating a short cutscene in Unity. Come back for more Unity developer articles.