Events are triggers that you can listen to in order to do something when they happen. They are the starting point for all the Flow and show up as special green nodes in graphs.
There are many kinds of events to choose from, grouped in sub-categories under the root Events category:
Two simple common events are Start and Update, both located under Lifecycle.
- Start gets called once when the graph or event handler is first created.
- Update gets called at every frame while the graph or event handler is active.
New flow machines start with both these events by default. :
Inputs & Outputs
All events have a single Trigger control output that starts the flow when they are triggered.
When events have value inputs, these are options that influence when the event will get triggered. For example, on the On Timer Elapsed event, the number of seconds during which to wait is an event setting. Some events have a Target setting that determines which object is listening to the event. Most often, you'll leave this setting at its default value of Self.
The value outputs on events are arguments that are passed from the event, giving you more information about what actually happened. For example, on the On Trigger Enter event, the other collider that was involved in the collision is an output:
There is a special type of event, the Custom Event, that you can use to trigger your very own events across graphs, along with their custom arguments.
Let's say we wanted create a custom event called On Damage that should get called to make the character lose health. This event should have one integer argument that indicates the amount of damage to inflict.
First, we can listen to the event by creating a Custom Event unit (under Events). We will set its name to On Damage. The field below the name is the argument count, which we will set to 1.
Note that as always, indices are zero-based, so the first argument is labeled Arg. 0.
To trigger the event from elsewhere, we must use the Trigger Custom Event unit, located right under the Custom Event unit in the fuzzy finder. We will configure it the same way, like a mirror. Make sure to type the name of the event in the exact same way, because it is sensitive to case and whitespace.
For example, if you were creating a flow machine on a boulder that could hit the player, you might want to use the force of the impact as the damage. Your trigger graph would therefore look something like this:
Notice we are using the collider that hit with the boulder as the target of our trigger. This means the On Damage event will be triggered on all machines attached to that collider.
Finally, you could use the damage value to subtract health from the receiver object, for example:
Custom events do not require a receiver and will not cause an error if there is no listener to handle them.
Customer support service by UserEcho