Download

Extending C++ class in BP questions..

Hey, if I extend a function created in C++ in a blueprint object from that same class - Will the extended event (C++ code and BP code) *both *fire when called from either the c++ class or the BP? Or will the extended part only get called if the event is called from the BP object?

Also I’m struggling to figure out how to extend my own c++ function, can I only do that to lower level class functions like beginPlay? Can I create my own C++ function and then add to that in BP? I’ve looked through examples and googled it but I’m probably missing something too basic to mention from the things I looked at. :confused:

Thanks.

Hi RumbleMonk!

As far as I understand, yes: If you overwrite BeginPlay() (and call Super::BeginPlay() in it), it will run your C++ code and fire the event in the blueprint.
If you want to define your own events, be sure to check the documentation for “BlueprintImplementableEvent” and “BlueprintNativeEvent”, which are both flags for the “UFUNCTION()” macro.

I hope I was able to help!

If you’re calling a virtual function, a call to that function will only call the furthest-child implementation of that function. To get both the function and your class’ parent’s version of the function to run, you can call Super::blahblahblah() in the child function.

More commonly, if I want my C++ code to interact with a blueprint function, I define a function in C++ with the tag BlueprintImplementableEvent, then override it in the blueprint.