Documentation

Learn how to use NodeCanvas

Download PDF Version

Using Signal Events

Signals are and can be used very similar to Graph Events, however they do not rely on a string-based name but rather or a Signal Definition asset reference which has to be created beforehand. They also support multiple parameters in contrast to simple Graph Events and in all respects are an alternative to normal Graph Events.

Creating a Signal Definition

The first thing that has to be done is to create a Signal Definition asset which is possible in the project tab and under “Create/ParadoxNotion/CanvasCore/Signal Definition”. A Signal Definition acts as a reference to a single event and also allows to define the parameters (name and type) that the event uses through the Signal Definition inspector. All types added in the Preferred Types Editor are supported as normal.

Invoking a Signal

Similar to Graph Events, to invoke a Signal, you need to use the Invoke Signal Action Task. However instead of giving the action a string-based name for the event, we instead need to assign the Signal Definition we want to invoke in the relevant inspector field. Once the target Signal Definition is assigned, all parameters defined in the Signal Definition will show up possible to parameterized either with a direct value or via a Blackboard Variable as normal. Also similar to normal Graph Events, there is a checkbox option to invoke the Signal Globally if required.

A Signal can also be invoked through code if required. To do this, we need to have a reference to the Signal Definition asset object and then call its Invoke method. The Invoke method takes 4 parameters.

  • Sender: The object that invokes the signal (this can be ignored in most cases)
  • Receiver: The object that the signal targets (if not Global).
  • IsGlobal: Whether or not the signal is invoked globally (in this case the receiver can be ignored).
  • Args[]: A params object array for the parameters of the signal. Please note that these have to be in the correct type order as defined in the Signal Definition inspector.

Checking a Signal

To check a Signal, the Check Signal Condition Task needs to be used. Similarly, the Signal Definition target needs to be assigned in the Check Signal condition inspector and as soon as this is done, all the signal parameters will be shown, possible to (optionally) link each of them to a Blackboard variable. Once the signal is invoked and the condition evaluates to true, the invoked signal parameter values will be stored to the respective linked Blackboard variable if any.

Yes No Suggest edit
2 of 3 users found this section helpful
Suggest Edit