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.
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:
The labels of this drop down field different depending on the event, but in general the working is as follows:
|Never||The function is never called.|
|On Start||The function is called when the event starts.|
|On End||The function is called when the event ends.|
|While Active||The function is called while the event is active.|
|Wile Inactive||The function is called while the event is not active.|
|On Change||The function is called when the event starts or ends.|
|Always||The function is called every frame.|
The target GameObject in the scene on which the function is called.
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.
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.
Depending on the parameter type additional settings can be set in the Options section.
- Inverse The parameter value will be inverted before it is sent to the function
- Mutliplication The parameter value will be multiplied by this value before it is sent to the function.
- 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.