Calling BP Events From CPP

From UE4: Community Wiki
Jump to: navigation, search

Events in Blueprint[edit]

There are a few ways to fire events in Blueprint but I am going to cover BlueprintImplementableEvent and BlueprintNativeEvent.


This is the simplest one and it allows you to call a Blueprint event from C++. You just need to use the BlueprintImplementableEvent in the UFUNCTION macro in the header file and that's it.

void MyBPEvent();

Which shows up in the blueprint like this:

Blueprint Implementable Event

Now you can call it from like any other method in C++:

void AMyEventActor::BeginPlay()


This one works almost identically to BlueprintImplementableEvent except that it requires a C++ function to be implemented. The native definition needs to have _Implementation after it but when calling it, call the header defined function. This gives you the advantage to optionally run the behavior of the native method if you add a call to the parent function.

(.h File)
void MyNativeEvent();
(.cpp File)
void AMyEventActor::BeginPlay()

void AMyEventActor::MyNativeEvent_Implementation()
	UE_LOG(LogTemp, Warning, TEXT("Doing some work here"));

Blueprint Native Event

When it runs the output is:

Event Output