Cutscenes
Last updated
Last updated
Create a new Cinemachine Virtual Camera by selecting GameObject -> Cinemachine -> Virtual Camera.
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.
Add a Playable Director and Animator component to the Virtual Camera object.
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.
Within the Timeline window, press the plus (+) symbol and choose the Animation Track option.
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.
When you have finished creating the animation on the timeline, be sure to assign all required references in the Cutscene Trigger component.
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.
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.
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.
When you finish animating the CutscenePlayer, assign it in the Cutscene Trigger to the Cutscene and Cutscene Player fields.
I highly recommend watching some YouTube tutorials on how to use Timeline. This will help you unlock its true potential and create fantastic cutscenes.