Documentation

Learn how to use NodeCanvas

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.

As of version 3.x, there is also an alternative way for utilizing graph events called Signals.

Sending an Event

You can send an event using the included Action Tasks SendEvent or SendEvent<T> in case it is 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 an example of 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 called CheckEvent or CheckEvent<T> in case of a value event.

CheckEventT

Using the CheckEvent<T> also allows you to store the received event 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 straightforward, but using events in Behaviour Trees 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 when 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
15 of 16 users found this section helpful
Suggest Edit

© Paradox Notion 2014-2024. All rights reserved.