# Unity

You can use Unity event nodes to initiate flows in AFX graphs. For more information, see [flows](https://docs.engagevr.io/developer/afx/afx-graphs/flows "mention").

## Script lifecycle nodes

Most of the Unity event nodes that are available relate to stages in Unity's script lifecycle. For more information about the script lifecycle, refer to [Order of execution for event functions](https://docs.unity3d.com/2021.3/Documentation/Manual/ExecutionOrder.html) in the Unity documentation.

Nodes that relate to Unity's script lifecycle have a single output port, which initiates a flow when the lifecycle event occurs.

<figure><img src="https://2640392766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5yxYHsXtlAaoMUrDWhLm%2Fuploads%2Fgit-blob-dd05d581ae681fa4ba6a6e76dcfdd0dd87dedfee%2Fafx_node_fixed_update.png?alt=media" alt=""><figcaption><p>Example node for a stage in the Unity script lifecycle</p></figcaption></figure>

The following table summarizes the available nodes:

<table><thead><tr><th width="199">Node</th><th>Description</th></tr></thead><tbody><tr><td>On Enable</td><td>Called when the object becomes enabled and active.</td></tr><tr><td>Start</td><td>Called before the first frame update only if the script instance is enabled.</td></tr><tr><td>Fixed Update</td><td>Happens at fixed intervals of in-game time rather than per frame.</td></tr><tr><td>Update</td><td>Called once per frame and is the main function for frame updates.</td></tr><tr><td>Late Update</td><td>Called once per frame, after <code>Update</code> has finished.</td></tr><tr><td>On Disable</td><td>Called when the object becomes disabled or inactive.</td></tr></tbody></table>

## Timed Update

Initiates a flow at defined intervals.

<figure><img src="https://2640392766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5yxYHsXtlAaoMUrDWhLm%2Fuploads%2Fgit-blob-b71c146b0ea86736e3deac3b952ce61285f7303e%2Fafx_node_timed_update.png?alt=media" alt=""><figcaption><p>Timed Update node</p></figcaption></figure>

## Inputs

<table><thead><tr><th width="160">Name</th><th width="166">Type</th><th>Description</th></tr></thead><tbody><tr><td>Duration</td><td>Float [editable]</td><td>The interval, in seconds, between activation of flows.</td></tr></tbody></table>

## Outputs

<table><thead><tr><th width="163">Name</th><th width="164">Type</th><th>Description</th></tr></thead><tbody><tr><td>Exit</td><td>Flow</td><td>Initiation of a flow.</td></tr></tbody></table>
