Download

C++ and Blueprint parent/child function interaction

Until recently I thought that calling a parent implementation from Blueprint works the same as in C++ for all functions/events. E.g. if I have a BlueprintNativeEvent with an implementation in C++ I would call the parent implementation in Blueprint and then append the other Blueprint nodes. Then I noticed that for something like BeginPlay or TickComponent the parent call seems to do nothing in Blueprint, and for example BeginPlay for Blueprint is called from UActorComponent::ReceiveBeginPlay, meaning the order of calls is also different from what you would expect from a “regular” C++ function chain. So what gives? When should you call parent functions from C++ in Blueprint? What are the general rules here?

I like to think about blueprints as a separate layer. I mostly use blueprint implementable events. If you check the source code, you’ll see functions with the K2 prefix. That means its a blueprint function (Kismet 2.0 I believe?).

// Called when the player fires the weapon. Core functionality implemented here.
virtual void Fire();

// Blueprint event for when the weapon is fired. Shooting effects are handled here.
UFUNCTION(BlueprintImplementableEvent)
void K2_OnWeaponFired();

Maybe I just phrased the question badly but your answer is completely beside the point. Also, Blueprint functions do not have to be prefixed with K2, it is just a convention Epic uses, mostly to avoid naming conflicts with native functions.