Blueprint native events
When using the UFUNCTION
macro in C++, you can turn a function into a Blueprint native event by simply adding the BlueprintNativeEvent
tag to that macro.
So, what is a Blueprint native event? It’s an event that is declared in C++ that can have a default behavior, which is also defined in C++, but that can be overridden in Blueprint. Let’s declare a Blueprint native event called MyEvent
by declaring a MyEvent
function using the UFUNCTION
macro with the BlueprintNativeEvent
tag, followed by the virtual MyEvent_Implementation
function:
UFUNCTION(BlueprintNativeEvent) void MyEvent(); virtual void MyEvent_Implementation();
The reason why you have to declare these two functions is that the first one is the Blueprint signature, which allows you to override the event in Blueprint, while the second one is the C++ signature, which allows you to override the event in C++.
The C++ signature is simply the name of the event followed by _Implementation...