Event Dispatchers

By binding one or more events to an Event Dispatcher, you can cause all of those events to fire once the Event Dispatcher is called. These events can be bound within a Blueprint Class, but Event Dispatchers also allow events to be fired within the Level Blueprint.

Creating Event Dispatchers

Event Dispatchers are created in the My Blueprint tab of the Blueprint Editor.

To create a new Event Dispatcher:

  1. In the MyBlueprint click the plus_Button.png button on the Event Dispatcher category: myblueprint_eventdispatcher.png.

  2. Enter a name for the Event Dispatcher in the name field that appears at the end of the list in the My Blueprint tab.

    name_event_Dispatcher.png

Setting Properties

By selecting the Event Dispatcher in the My Blueprint tab, you can edit its properties in the Details panel. You can set the tooltip and category for your Event Dispatcher, as well as add inputs.

Adding inputs to your Event Dispatcher allows you to send variables to each event bound to your Event Dispatcher. This allows data flow not only within your Blueprint Class, but also between your Blueprint Class and the Level Blueprint.

The process to add inputs to your Event Dispatcher is similar to the workflow for adding inputs and outputs to functions, custom events, and macros. If you would like to use the same inputs as another event, you can use the Copy Signature from dropdown to indicate the event. To add your own inputs to the Event Dispatcher:

  1. Click on the New button in the Inputs section of the Details pane.

    new_input_Dispatcher.png

  2. Name the new input and set its type using the dropdown menu. In this example, there is a String input parameter named MyStringParam.

    named_new_Dispatcher.png

  3. You can also set a default value and indicate whether or not to pass the parameter by reference by expanding the entry for the parameter.

    expanded_input_Dispatcher.png

    To change the location of the pin for this parameter on the edge of the node, use the up and down arrows in the expanded Details pane entry.

Using Event Dispatchers

Once you have created the Event Dispatcher, you can add event nodes, bind nodes, and unbind nodes linked to it. Although you can Double-click on the Event Dispatcher entry in the My Blueprint tab to open the Event Dispatcher's graph, the graph is locked and you cannot modify the Event Dispatcher directly. The bind, unbind, and assign methods all allow you to add events to the Event Dispatcher's event list, while the call method activates all the events stored in the event list.

All of the nodes described below can be added in both the Blueprint Class and the Level Blueprint. Except for the Event node, each node has a Target input pin:

  • In the Blueprint Class, this pin is automatically set to Self. This means that the event list is changed for the class, so every instance of the class will be changed.

  • In the Level Blueprint, this pin must be connected to a reference to an instance of the class in the level. This means that the event list will only be changed for that particular instance of the class. The Level Blueprint documentation explains how to create any Actor references you might need.

event_dispatcher_call_node.png

Calling an Event Dispatcher with a Call node causes all of the events bound to the Event Dispatcher to fire. You can have more than one Call node for each Event Dispatcher, and you can also call the Event Dispatcher in both Blueprint Classes and Level Blueprints.

bind_node.png

Calling the Event Dispatcher will have no effect if there are no events bound to it. Consider that each Event Dispatcher has a list of events associated with it. The way to add an event to this list is by using a Bind Event node, and the way to remove an event from this list is by using an Unbind Event node. It is also possible to unbind all of the events currently bound to an Event Dispatcher with an Unbind All Events node.

dispatcher_event.png

Using the Event option on the Event Dispatcher's menu creates a custom event with the correct signature so that it can be bound to the Event Dispatcher. While the event node appears similar to a Custom Event node , without being connected to a Bind node, this event will never be triggered when the Call [EventDispatcherName] node is executed.

Tags