Comment on page
- 1.Create a new Cinemachine Virtual Camera by selecting GameObject -> Cinemachine -> Virtual Camera.
- 2.You can define whether the cutscene should be triggered by a trigger, interact, or event. In this particular example, I've added a Cutscene Trigger component to the Button object and set the trigger type to Event as I want to play the press sound using the Custom Interact Event component. Then set the Cutscene Type to Camera Cutscene.
If you enable Wait For Dialogue, the cutscene will not be played until the dialogue ends.
- 2.Add a Playable Director and Animator component to the Virtual Camera object.
- 2.Open the Timeline window by selecting Window -> Sequencing -> Timeline. Select the object containing the Playable Director component, and then click on Create in the Timeline window. This action will generate a new Timeline Asset.
- 3.Within the Timeline window, press the plus (+) symbol and choose the Animation Track option.
- 6.Assign a Virtual Camera to the Animation Track field. This will allow us to animate the virtual camera within the timeline window. Next, click on the red record button to start creating the animation.
For those unfamiliar with creating animations using Timeline, you can access the Animation window by first adding a keyframe to the timeline track (by moving the object) and then clicking on the three dots -> Edit in Animation Window.
- 7.When you have finished creating the animation on the timeline, be sure to assign all required references in the Cutscene Trigger component.
- 1.Create or copy a CutscenePlayer object from the Playground Demo scene. This object represents a simplified version of the player that contains only the camera.
The CutscenePlayer object should contain Animator, Playable Director and Cutscene Player components.
- 2.Create a Box Collider object and add a Cutscene Trigger component to it. In this example, the trigger type is set to Trigger so that when the player enters the trigger, the cutscene will play. Then set the Cutscene Type to Player Cutscene.
- 3.Open the Timeline Window and start recording the CutscenePlayer object. You can animate the CutscenePlayer object as you want, you can add cutstom objects to it, for example hands, and animate them easily.
- 4.When you finish animating the CutscenePlayer, assign it in the Cutscene Trigger to the Cutscene and Cutscene Player fields.
When you enable the Wait For Blend In option, the cutscene will not be played until the main camera is blended into the cutscene camera. You can use the Blend In Offset value to specify in what time to play the cutscene.
The value 0.5 means that the cutscene will be played at half the blend time for a smooth transition.
I highly recommend watching some YouTube tutorials on how to use Timeline. This will help you unlock its true potential and create fantastic cutscenes.