A Custom Event is an Event in Unreal Engine created by yourself.
This means it is a valuable Blueprint node used to execute sequences of node actions and functions in Blueprints.
Think of an Event BeginPlay, but instead of calling the event at the beginning of the game, you can call it wherever and whenever you want.
Let’s learn how it works and how you can use it in your Unreal Engine projects.
How can I create Custom Events?
To create a Custom Event, go to the Event Graph of any Blueprint within your game.
Right-click and search for ‘Add Custom Event…‘
This action will generate an event node, easily recognizable by its red color and the text ‘Custom Event’ written on it.
It is important to name the event with something you will easily remember. In this example, I named mine ‘GameDevEXP‘, but feel free to choose any name you like.
How to execute a Custom Event?
There are two main ways to execute a custom event in Unreal Engine: one where you trigger it directly, and another where it is triggered after a set time.
Let’s learn about these two methods.
Calling a Custom Event in Unreal Engine
If you want to call a Custom Event in Unreal Engine, just search in the Event Graph for the name that you gave your Custom Event.
Since I named my event ‘GameDevEXP’, the execution node is going to be named exactly the same.
You will be able to recognize it easily because the node will be blue instead of red, but it will still have the event symbol in the top left corner of the blueprint.
Set Timer by Event
The second method is to call it using the ‘Set Timer by Event‘ Blueprint node.
To do it, just connect the ‘Event‘ input node, to the Custom Event you created.
Then, set the ‘Time‘ value in seconds, and after that time, the event will execute.
However, if you want the event to be executed in a loop, simply check the ‘Looping‘ option.
In conclusion, creating your own Custom Events is like having a special key to unlock new actions in your game.
Calling these events whenever and wherever you want will give you the freedom to develop games more easily.
I hope this helps! Keep creating!