Download

Blueprint polymorphism my abstract base BeginPlay not called

Hi

I have a BP base class for all my AIControllers , and i just realised its BeginPlay never gets called before the BeginPlay of its derived class, infact it never gets called at all

In c++ we have to do Super call for base class, do we have to do the same in blueprint.

Generally speaking one would expect base class event handlers like BeginPlay to be called before the derived.

Also if need be how would one go about calling base class BeginPlay in blueprint

Upon further testing i find the tick of base class gets called. But not the BeginPay or OnPossess

Upon Yet more testing i find that in a case of parent and derived AIController classes

ONly one of the construction scripts gets called. If i add any codee to derived consrtruction script, it gets called, but not its base construction script.

If i remove the code from Derived construction script the base construction script gets called instead. Meaning its either or, i was not expecting this at all.

Right now i am totally confused as to how to expect parent and derived class should operate in blueprints. I wanted to investigate which construction script gets called first between parent and derived using break points. And instead i find its an either or situation.

Any explanation much welcome cheers

You said it yourself, you have to super. Each event node you can right-click, and if the parent has that function, you’ll see an option like “(parent) EventName”. That’ll give you the super node.

thanks very much for that. right click on the event itself and not empty space, select “add call to parent”.

And the same goes for construction script, thanks again.

Its a shame such important thing as this is not documented anywhere, i certainly have not seen it in documents.