# Using Events

#### What to learn?

* Connect events from **Scene Flow Manager**

**Steps**

1. Setup a working game flow follows the previous tutorials. We have a simple flow setup here.

![](/files/-LXTR_O0L3LPxjA-BpuW)

1. 2\. Open the bootstrap scene. Select the **Scene Flow Manager.**

![](/files/-LXTR_O2I_o3RD4FrAPt)

3\. Add a new script and name it **DemoEvents.cs** ( You can use your own name or script).

![](/files/-LXTR_O3UFliXnYiLMPd)

4\. Open the **DemoEvents.cs** and add functions called ***HandleLoadEvent() and HandleUnloadEvent()***.

```csharp
    public void HandleLoadEvent(SceneInfo current, SceneInfo next)
    {
        Debug.Log("[HandleLoadEvent]  Current: " + current.SceneName + " Next: " + next.SceneName);
    }

    public void HandleUnloadEvent(SceneInfo current, SceneInfo next)
    {
        Debug.Log("[HandleUnloadEvent]  Current: " + current.SceneName + " Next: " + next.SceneName);
    }
```

5\. From the inspector, open the events foldout and you will see a list of events.

![](/files/-LXTR_O4Gwi0NQH3FIQ_)

6\. Press the **"+"** button and add a new event under **OnSceneLoaded** event.

![](/files/-LXTR_O5DS1PSwdzlAty)

7\. Drag and drop the **Scene Flow Manager** gameobject to the object field.

![](/files/-LXTR_O61jHsVX6vcOKo)

8\. From the functions drop down, select the ***HandleLoadEvent()** from the DemoEvents object.*

![](/files/-LXTR_O7PGBRO5KK1exy)

*9. Repeat the steps for **OnSceneUnload** event and **HandleUnloadEvent**() function.*

![](/files/-LXTR_O82WgYZkXsx05Q)

10\. Play the scene. You will see the events log in the console when you run the project.

![](/files/-LXTR_O95vkLcb8MGBfN)


---

# 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.digicrafts.com.hk/sceneflow/tutorials/tutorial-3.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.
