Event System

You are here:
< All Topics
Table of Contents

FlowReactor comes with a complete event system which allows you to send events with custom parameters across different graphs.
Events are defined in an Eventboard (similar to Blackboards).
Additionally you can also use the event system outside of a graph by using the FlowReactorEventListener component on any game-object.

Create Eventboard and Events

To create events you will need to create an Eventboard first.

  1. Right click in the projects view and select Create / FlowReactor / New Eventboard.

  2. Select the newly created eventboard and add your first event called “Say Hello”.

Assign the Eventboard

We now have to assign the Eventboard to our Graph.

  1. Goto the properties view and select Events. You can now drag and drop the Eventboard asset file to the inspector.
    Events can now be called by using the CallEvent node.

Custom Parameters

Each event can have custom parameters. Inside of the Eventboard you can define parameters for each event. It is important to know that you are not assigning any parameter values in the Eventboard, you are only building the parameter “template”. Parameter values or arguments can be assigned in the CallEvent node when calling an actual event.

For this example lets add a string parameter to our “Say Hello” event.

  1. Click on add parameter and select string.

  2. Name it: Message

Good to know

parameter values/arguments are assigned on the CallEvent node only. EventListener node on the other hand are retrieving the parameter values/arguments coming from the event.

Call an event

Let’s call our event with the custom parameter.

  1. Create an OnStart node

  2. Connect the OnStart node with a CallEvent node

  3. Select the CallEvent node. You can now see all available events in the node inspector, select the “Say Hello” event.

  4. Assign a text to the event parameter which you want to pass to. For example: “Hello”

Listen to an event

Now we need to add an EventListener node to actually listen to our event.

  1. Add an EventListener node

  2. Select the event “Say Hello” from the node inspector.

  3. We now have to store the incoming event parameter value – which is the string variable: Message – to a global blackboard variable. So make sure you have created and assigned a blackboard to your graph with a string variable.

  4. Now you can “connect” the event parameter “Message” to the blackboard string variable.

  5. To see if our event gets called and if our event listen node is reacting to it. Connect a Debug.Log node to the EventListener node.

  6. Connect the “Log” variable from the Debug.Log with the Blackboard variable.

  7. Assign your graph to a FlowReactorComponent in the scene. Run the scene and you should see the debug.log output: “Hello” in the Unity console.

View all connected nodes

You can inspect all connected CallEvent and EventListener nodes for each event. Simply click on “Connected Nodes”. If the node exists in the current graph you can quickly navigate to it.

Sequencing Events

There are occasions where you want an event listener node to listen to an event only if other prerequisites have been made or another event have been called first.

This is best achieved by using sub-graphs. An event listener node inside of a sub-graph gets only triggered when the sub-graph is currently active. 

So for example lets assume we have an Event listener node (A) in the root graph which is connected to a sub-graph. Inside of the sub-graph we have another Event listener node (B).
This way, event listener B will only listen if event A has been called first. 

Privacy Settings
We use cookies to enhance your experience while using our website. If you are using our Services via a browser you can restrict, block or remove cookies through your web browser settings. We also use content and scripts from third parties that may use tracking technologies. You can selectively provide your consent below to allow such third party embeds. For complete information about the cookies we use, data we collect and how we process them, please check our Privacy Policy
Consent to display content from Youtube
Consent to display content from Vimeo
Google Maps
Consent to display content from Google