Using AFX Events
Last updated
Last updated
You can trigger an AFX event in a graph, which then causes any associated listeners to activate. This can include the the activation of flows in other graphs. To use AFX events, you require the following three components:
An AFX Event asset.
An AFX Invoke AFXEvent
node in an AFX graph that will trigger the event.
Something to listen for the invoked event. You can use an On AFXEvent Invoked
node or an AFXEvent Component
. An invoked event can trigger multiple listeners.
In the Project panel, right-click in a folder, and then select Create > AFX Event.
Enter a name for the AFX asset.
Add an AFX Invoke AFXEvent
node in an AFX graph.
Choose one of the following options:
Drag the AFX event asset that you want to invoke onto the Afx Event field.
Select the circle icon in the Afx Event field to open the Object Picker window, and then select the AFX event asset that you want to invoke.
Connect a flow to the Enter port of the AFX Event Invoke
node. When the flow is activated, the event will be invoked.
To respond to an invoked event in an AFX graph, use an On AFX Event Invoked
node. When the event is invoked, the node will initiate a flow.
Add an On AFXEvent Invoked
node in the AFX graph where you want to respond to the event.
Choose one of the following options:
Drag the AFX event asset to which you want to respond onto the Afx Event field.
Select the circle icon in the Afx Event field to open the Object Picker window, and then select the AFX event asset to which you want to respond.
Connect the Exit port from the On AFX Event Invoked
node to the nodes that you want to activate.
You can use an AFXEvent Component to trigger a list of function calls. To use an AFXEvent Component, complete the following steps:
Optional: Create an empty game object.
Add an AFXEvent Component
component to your chosen game object.
Choose one of the following options:
Drag the AFX event asset to which you want to respond onto the Afx Event field.
Select the circle icon in the Afx Event field to open the Object Picker window, and then select the AFX event asset to which you want to respond.
In the On Event Triggered list, select the plus symbol. A row for a triggered event appears.
Drag a game object that you want to modify in response to the event onto the object field.
From the function list, select the function that you want to call in response to the event.
Repeat from step 4 as needed.