Documentation

Learn how to use NodeCanvas

Download PDF Version

Using Graph Events

Graph Events are a great way to signal the graph that something happened and react accordingly. NodeCanvas has an internal Event system which can be used in any type of graph. Events can also have any type of variable included and thus possible to also communicate variables with them.

Sending an Event

You can send an event using the included Action Tasks SendEvent or SendEvent<T> in case its a value event. When using the SendEvent<T> you will also be able to provide a value for the event to transfer from within the editor inspector. Following is a SendEvent<float>.

SendEventT

You can also send an event easily from code of course. You can do this by having a reference to the GraphOwner. For example.

Checking an Event

To Check for an event in the Graph, you should use the included Condition Task, CheckEvent or CheckEvent<T> in case of a value event.

CheckEventT

Using the CheckEvent<T> also allows you to store the received event’s value to a Blackboard Variable for later usage. The CheckEvent condition will return true for only one frame, not until the event is consumed.

In regards to FSMs, using events is very straigtforward, but using events in BehaviourTrees along with the various Decorators included allows for a lot of flexibility in designing a behaviour tree. For example:

  • You can use a CheckEvent along with an Interruptor Decorator to interrupt the decorated child if the event is received.
  • You can use a CheckEvent along with a Conditional Decorator to trigger access to the decorated child when the event is received.
Yes No Suggest edit
3 of 3 users found this section helpful
Suggest Edit