Although OnDestroyed is BlueprintAssignable and ReceiveDestroyed is a BlueprintImplementableEvent, I attempted to implement them in C++ in order to run some routines whenever an actor gets destroyed. However, whenever I implement them in C++, they never get called on my actor’s destruction. Is there another way to run C++ code upon an actor’s destruction?
Hello, Alonzo
I am sorry to hear about your problem.
You can do it like this:
OnDestroyed.AddDynamic(this, &AMyActor::WhenDestroyed);
Please note that you need to declare and define the appropriate function and it needs to be marked as UFUNCTION():
UFUNCTION()
void WhenDestroyed();
Hope this helped!
Have a great day!
Thank you for your help!