# Interaction Events

Now that we have set up our behaviour logic, how do you allow users in HoloFair to interact with these objects?

Here we have interactions events. These UnityEvents are invoked by user interaction in HoloFair, meaning you can predefine certain behaviour and logic of what each interaction does through the Unity Editor.

### OnStartHandler

<figure><img src="/files/1pOuxxn5Pn8tFcj4bfvG" alt=""><figcaption></figcaption></figure>

The following event is invoked on Start, which is when the venue is loaded. Pretty simple to use.

### OnTriggerHandler

When you need a specific behaviour when a player collides with trigger collider, you can use OnTriggerHandler.

Add OnTriggerHandler to an object that has any type of collider that is marked as a IsTrigger.

<figure><img src="/files/4eUddZ4kyeVFwP2dnyGI" alt=""><figcaption></figcaption></figure>

There is the property TargetTag, which allows you to specify which tag should the trigger look out for. Most of the time, we only look out for our local user, so keep the *LocalPlayer* tag.&#x20;

The events are for three types of interaction with trigger colliders. When the user enters the trigger, OnTriggerEnter is invoked. When the user leaves the trigger, OnTriggerExit is invoked. On every fixed update, if the player is within the trigger collider, OnTriggerStay is invoked.&#x20;

### OnClickHandler

To create interactable objects within your world, you'll need to use OnClickHandler.&#x20;

Create a Tag named "Interactive" as Tag 1 in the Tags list.&#x20;

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

Add OnClickHandler to an object that has any type of collider that is marked as a IsTrigger and set its Tag as "Interactive".

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

Firstly, the most important properties of this components are its events. OnEnter is invoked when the user's mouse hovers over the trigger. OnExit is invoked when the user's mouse leave the trigger. OnClick is invoked when the user long-clicks on the trigger.

Use **Hold Interaction Time** to set hold duration required for the event to fire.&#x20;

Notice that if you leave it 0, the click will fire immediately, no hold required.

Additionally, you may replace the cursor with a Texture of your choice to give the user better feedback as to what's going on. Reference the texture of choice in the Cursor Texture field and call OnClickHandler.ReplaceCursor(*true*) OnEnter and OnClickHandler.ReplaceCursor(*false*) OnExit as demonstrated below.

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

Usually, you'd leave Cursor Mode and Hot Spot as their default values. For more information on how ReplaceCursor works, see [this](https://docs.unity3d.com/ScriptReference/Cursor.SetCursor.html).&#x20;


---

# 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.holofair.app/development/features/interaction-events.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.
