Base Class Construction Script not Being Called

When deriving a new blueprint from a custom base class it is expected that ConstructionScript will be invoked upwards from the derived class, then to the parent class.

I have implemented a component using a custom base class and during refactoring I have attempted to migrate initialization logic (required, currently located in the derived class) out of the sub-classes and into the parent class ConstructionScript. The Construction script is never called (as proven with a simple print string.)

I believe this is a bug because either:

  1. This behavior should work but doesn’t.
  2. This behavior should not work and is not documented anywhere that I can find in the documentation or in the blueprint editor when viewing a base class construction script.

I would prefer, in an effort to minimize boilerplate (and promote a basic level of dependency injection) that we could get this implemented.

The same holds true for events (such as Begin Play) in the base class; they never get called.

This resolves my immediate problem but still requires boilerplate (the invocation of the parent class method.) It would be very nice indeed to get an option somewhere to make this behave in such a way that parent methods are always called if the child doesn’t override it. (Which could be as simple as being able to delete the constructionscript/events from the child classes.)

Hi ,

It sounds like your Blueprints are not using the Call to Parent Function. It can be access by right-clicking any event that the parent uses (ex. Event Begin Play or Construction Script) and selecting the “Add call to parent event function” option. Then you will get a node that will activate the patent’s events. You can find out a little more about this here:

https://docs.unrealengine.com/latest/INT/Resources/ContentExamples/Blueprints_Advanced/2_5/index.html

You are correct in that they are not explained well enough. I will talk with our documentation team about it.

Please let me know if this helps at all. I am happy to further assist if it does not.

2 Likes

IMHO, it’s much more odd that I can’t right click for the add node interface and get a result from “base” or even “parent” in a child class/function.
It deploys a node that I just can’t get in the normal fashion, which is weirdly inconsistent, considering you can add almost any node to any BP.

In fact, right clicking and searching for “base” is what led me to google this, and end up here.