# Cutscenes

### Camera Cutscene

1. Create a new **Cinemachine Virtual Camera** by selecting **GameObject -> Cinemachine -> Virtual Camera.**

<figure><img src="/files/iCEEySUOZkZFRnSJTEVr" alt=""><figcaption></figcaption></figure>

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**.

<div><figure><img src="/files/mB1S9Sz5bZ7YUm4BOUSm" alt=""><figcaption></figcaption></figure> <figure><img src="/files/POMKfsBhY2gnHUeKw30Y" alt=""><figcaption></figcaption></figure></div>

{% hint style="info" %}
If you enable **Wait For Dialogue**, the cutscene will not be played until the dialogue ends.
{% endhint %}

2. Add a **Playable Director** and **Animator** component to the **Virtual Camera** object.

<figure><img src="/files/grvS3K4u9VAJdr8LMKAA" alt=""><figcaption></figcaption></figure>

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.

<figure><img src="/files/Sp6ln7s2Z69MG13qKCQb" alt=""><figcaption></figcaption></figure>

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.

{% hint style="info" %}
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**.
{% endhint %}

<figure><img src="/files/k79QxbHwZGNu05Hx4Mjf" alt=""><figcaption></figcaption></figure>

7. When you have finished creating the animation on the timeline, be sure to assign all required references in the **Cutscene Trigger** component.

### Player Cutscene

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.

<figure><img src="/files/Uq6ga2xWB41k92yBADOu" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
The *CutscenePlayer* object should contain **Animator**, **Playable Director** and **Cutscene Player** components.
{% endhint %}

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**.

<figure><img src="/files/Ge4qhhAAOZF3wORsmCVu" alt=""><figcaption></figcaption></figure>

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.

<figure><img src="/files/3lOE0Lx9iMTpmxMXHexE" alt=""><figcaption></figcaption></figure>

4. When you finish animating the **CutscenePlayer**, assign it in the **Cutscene Trigger** to the **Cutscene** and **Cutscene Player** fields.

<figure><img src="/files/u9fXAG2REqTBLJxO8MCT" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
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.
{% endhint %}

{% hint style="warning" %}
I highly recommend watching some **YouTube** tutorials on how to use **Timeline**. This will help you unlock its true potential and create fantastic cutscenes.
{% endhint %}

{% embed url="<https://www.youtube.com/watch?v=G_uBFM3YUF4>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.twgamesdev.com/uhfps/guides/cutscenes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
