sábado, 4 de junho de 2016

BP Compendium 2: Custom Events

Custom Events


In addition to the events provided by the Unreal Engine, you can create new events that can be used in the Blueprint where the event was created or be called from other Blueprints.

To create a Custom Event, right-click on the EventGraph, expand the "AddEvent" category and select "Add Custom Event...". In the "Details" tab can be set the event name and the input parameters. Events do not have output parameters. The images below show an event called "AddScore" which receives a number of points that should be added to the current score.




Assuming that this event was created in a Blueprint called "BP_Player", the image below shows the event being called in another Blueprint that represents an item that gives points when it is collected. The "Cast To" action is used to ensure that was the "BP_Player" that collided with the item and also to get a reference of the type "BP_Player" to access the "AddScore" event.

Click to enlarge

An event has a small red square in the right corner that is known as "Delegate". This is just a reference to the event. Some actions receive an event as a parameter and is using the Delegate that makes this possible. In the example below the Delegate of the event "Clock" was used in the action "Set Timer by Event", so the "Clock" event will be called every second.

Click to enlarge


Table of Contents