overriding beginplay in c++ and BP
I have a subclass of actor written in c++, which needs to perform some operations on BeginPlay. That's easy enough to do in c++, but I want any blueprints that inherit from this class to be able to implement this event as well (and call the parent BeginPlay if required).
In order to try and solve this, I added "UFUNCTION(BlueprintNativeEvent)" ahead of my "void BeginPlay()" definition in the header file, and changed the code in my cpp file to BeginPlay_Implementation(). However, this doesn't work, because now I have two BeginPlay functions defined. If I change the category of the UFUNCTION, it works, but this seems like a hack.
Can anyone give me an example of code where the BeginPlay_Implementation() function is called AND the Event BeginPlay [blueprints] being fired?
edit: Turns out I wasn't calling Super::BeginPlay() in my c++ code.
The Blueprint event is actully ReciveBeginPlay() and it called in BeginPlay in AActor class. But i thing what you looking for is how to call Super::BeginPlay() in blueprint, you can do that by right clicking the event end there should be option to create call to paret and its gonna create orange node where you can call event in parent, its equivlent os Super call.
answered Sep 03 '14 at 01:08 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here