Download

C++ BeginPlay called despite missing parent call in blueprint child class

Hi, folks, I’ve got a base C++ class where I override a BeginPlay function. Then, I have a blueprint class and is a child class based on the C++ class. Inside the blueprint I override BeginPlay event and do some custom logic.

Problem is, despite whether call to a parent BeginPlay is pesent or not, C++ BeginPlay fires first, always. I added output logs to check how does the flow looks like, and it seems that the flow is as following:

  1. Call C++ parents class BeginPlay
  2. If inside parents C++ BeginPlay there is a call to a Super::BeginPlay, then jump to child class BeginPlay (sic! Super:: should call parents BeginPlay, not childrens!)
  3. Back to C++ parent class, finish BeginPlay funcion.

This issue is super annoying and counter intuitive. How on earth can Super::BeginPlay make a call to blueprint child class?

Does anyone know how to fix it and avoid parent class BeginPlay event call?

Cheers

After digging into source code I noticed that in the Actor class, inside BeginPlay function there is a call to ReceiveBeginPlay which is BlueprintImplementableEvent. In fact, this ReceiveBeginPlay is the BeginPlay displayed in blueprints. Thus, there is no way to avoid calling begin play to parent C++ class. Unless someone know something I don’t and actually know the way to avoid it (I’m not talking about blocking execution by wrapping BeginPlay code into condition that is executed based on flag that can be ExposeOnSpawn, this is ugly trick, will do the job but I’m looking on engine level solution).

Cheers