Syntax For Binding to an Engine Event Class
I'm attempting to bind the FLevelActorDeletedEvent Class in UEngine.h to a member function in my object class. This is the Declaration in Engine.h:
/** Editor-only event triggered when actors are deleted from the world /
Here's my attempt to bind to the DeleteMSComps function in my class:
I get the error:
...'TBaseMulticastDelegate::Add': no overloaded function takes 2 arguments
I'm not sure how to properly bind to this event class in UEngine.h. Any advice? Thank you!
First of all delegate is only a type which stores pointer (or pointers in case of multicast) and which can execute a call to stored function. In other word it needs object variable of that delegate, which store information about function in memory and send out calls to them. So you can not bind to delegate type as you attempting to do.
the function pasted below:
Is the one who gives you access to the delegate object which you can bind to, so it should look like this:
2nd issue is the one that causes the error. Function you trying to use is to bind another delegate to this delegate not to bind functions direly, not to mention it seems ot be deprecated too. There whole set of Bind (singlecast) and Add (Multicast) function that bind specific type of functions, check API refrence:
Since you trying to bind actor which is UObject you should use AddUObject function instead
3rd issue is
Make sure function you pointing have matching argument types in case of FLevelActorDeletedEvent, it should be AActor* so you function should be declered like this
Follow this question
Once you sign in you will be able to subscribe for any updates here