BlueprintNativeEvent

BlueprintNativeEvent allows to implement logic of event both in C++ and blueprint.

Concept

BlueprintNativeEvents are distinct from BlueprintImplementableEvents because a BlueprintNativeEvent can have a C++ implementation!

An existing example is the GameMode class, which has many important BlueprintNativeEvents.

 UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category="Game")  
 class AActor* FindPlayerStart( AController* Player, const FString& IncomingName = TEXT("") );

These core functions that define how a UE4 game can even get started obviously need a C++ implementation, but what if a Blueprint-Only project wants to override this functionality?

Or what if you have BP-only teammates who want to override the functionality of your C++ functions?

C++ definition

.h

UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category="JoyBall")
float GetArmorRating() const;

.cpp

float AJoyBall::GetArmorRating_Implementation() const
{
    //remember to call super / parent function in BP!
    return 100;
}

Keep in mind that blueprint events cannot be compiled out in non-editor builds. Surrounding it with #if WITH_EDITOR directive will cause a compilation error.

Blueprint override

File:NativeEventImplinBP.jpg
File:NativeEventImplinBP.jpg

Click on Override to see a list of all overrideable BP Native events and add yours to your blueprint graph for your c++ class!

File:BPNative2.jpg
File:BPNative2.jpg

Adding Call To Parent Function

You must ensure that your teammates understand they have to right-click on the function node and choose "Add Call To Parent Function" to cause your C++ implementation to run properly. This is also essential if they are adding to output values that you calculate in C++.

In the provided example, C++ implementation sets the result to 100. Blueprint override adds 50 to the result value.

If you'd like to completely override the behavior of the C++ method, simply don't add a call to the parent function.