How can I create Custom events for UObject?


#Instead of this

UFUNCTION(BlueprintNativeEvent, Category = "Magic")
    void OnLaunch();

and I give it some default implementation:

void UWolfdaleSpell::OnLaunch_Implementation()
    if (GEngine != nullptr)
       GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("Default OnLaunch implementation"));

#Do This

UFUNCTION(BlueprintImplementableEvent, meta=(FriendlyName = "Do The Happy Happy Launch"))
virtual void OnLaunch(FVector LaunchVelocity);

//there is no .cpp implementaiton

#Do Note this is .h only, no .cpp!!

You don’t need or ever use a default implementation with BlueprintImplementableEvent!

#Still Call the Event in Code

//.cpp to trigger BP event

//this-> is my personal syntax to know it is BP Event


I’m just showing you that you can send data to the BP from CPP, you dont have to include the LaunchVelocity parameter

#My Wiki Tutorial