Event Handlers

→ Event Handler API

An Event Handler provides an easy universal way to attach script functions to events and statuses. This is used in many components like Controller Input, Collision Event Handlers, Trigger Event Handlers and Head Target Event Handlers.

Editing

An Event Handler can be edited by pressing on the button. For every event It is possible to attach multiple event Handlers. When an event Handler has been defined, a new empty button will appear below which you can use to add an additional event Handler.

When an event Handler has been selected, a number of fields become visible:

Event Type

The labels of this drop down field different depending on the event, but in general the working is as follows:

NeverThe function is never called.
On StartThe function is called when the event starts.
On EndThe function is called when the event ends.
While ActiveThe function is called while the event is active.
Wile InactiveThe function is called while the event is not active.
On ChangeThe function is called when the event starts or ends.
AlwaysThe function is called every frame.

Target

The target GameObject in the scene on which the function is called.

Method

The method to call on the GameObject.
For each component on the GameObject an entry will be listed in the drop down. When selecting a component, the desired function can be chosen from the list of available functions.

Method Parameter

This can be set to a constant value or to From Event. In the second option, the parameter value will come from the event itself. Like the status of the button pressed, the GameObject which has entered the trigger collider or the GameObject to which the user is looking.

Options

Depending on the parameter type additional settings can be set in the Options section.

Boolean Parameter

  • Inverse The parameter value will be inverted before it is sent to the function

Integer Parameter

  • Mutliplication The parameter value will be multiplied by this value before it is sent to the function.

Float parameter

  • Multiplication The parameter value will be multiplied by this value before it is sent to the function
  • Trigger Level This determines at which values the Event Start and End happen. In the example above, the event will end when the value drops below 0.2 and will start again when the value raises above 0.8.