---
description: Connect custom behaviors to tracks
---

# Events

Events may be registered to perform additional actions when tracks are played in Timeflow.

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2Fr19BRQub6lrRJBfLMQcS%2Fimage.png?alt=media&#x26;token=c51b89bd-652c-4a38-983f-08d4aeeeb806" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
Be sure to select **Editor And Runtime** if you wish the event to fire in edit mode.
{% endhint %}

## Track On / Off

These events are triggered whenever the object's track state changes. This occurs when playing through a track section, or when jumping to another time where the track state is different.&#x20;

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FWlUZDKlPZY1tJKSyfIuJ%2Fimage.png?alt=media&#x26;token=d6ba2a1d-4fd1-449f-a9c6-4ee70d14cb57" alt=""><figcaption><p>In this example, during playback TrackOn() fires at 1 second and TrackOff() fires at 2 seconds.</p></figcaption></figure>

## Track Visibility Changed

This event is the same as the above however includes the boolean value of whether the track is on or off. Use this to trigger methods that take a bool parameter, or to drive the active state of an object or component.&#x20;

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2F7pPyFoH8arreWbXAQFtX%2Fimage.png?alt=media&#x26;token=b6cbd132-748f-477b-8433-61484e6c96d1" alt=""><figcaption></figcaption></figure>

Additional events may be added as needed by clicking the + button.

{% hint style="success" %}
If you need additional logic around an event, write a [MonoBehaviour ](https://docs.unity3d.com/Manual/class-MonoBehaviour.html)script with a function that can be called by the event.
{% endhint %}
