Add a delegate to OnComponentBeginOverlap in C++
Hi guys, I am trying to attach a delegate to the OnComponentBeginOverlap event.
Here is the header:
And the source file:
The problem is that I need to pass a TSciptDelagate to the Add function, but I don't know it's signature. Also I want to pass a delegate with the "void Function()" signature. Can you help me out?
asked Jun 25 '14 at 05:47 AM in C++ Programming
For those reading this with later engine versions (4.7+) here is the now correct method:
Function definitions should look like this:
Then in the constructor or wherever you desire you set it up with this:
answered May 24 '15 at 04:16 AM
First of, you have to declare your OnBeginOverlap and OnEndOverlap functions as follow:
Delegates must be UFUNCTIONs, and must match delegate signature as well, so you can't pass void Function() into this delegate.
Also, since it's dynamic multicast you have to add it like this:
First parameter is the pointer to the object that will execute the function passed as second parameter.
P.S. You don't need to use this in the constructor in this case, it's just excess.
Follow this question
Once you sign in you will be able to subscribe for any updates here