OnActorBeginOverlap Add Dynamic Not Working


So I am trying to bind one of my functions to the OnActorBeginOverlap event. I am following a tutorial in a book. I am stuck at the binding part which is exactly like the following advice. The advice here (A new, community-hosted Unreal Engine Wiki - Announcements and Releases - Unreal Engine Forums) says all I need to do is:

Step 1: Declare It (in the header file)


void OnOverlap(AActor* OtherActor)

Step 2: Define it

void ABleakwise::OnOverlap(AActor* OtherActor) { … }

and finally Step 3: Bind it.

OnActorBeginOverlap.AddDynamic(this, &ABleakwise::OnOverlap);

Unfortunately, this does not work. I get the error (in Visual Studio) that:
no instance of function template “FActorBeginOverlapSignature::__Internal_AddDynamic” matches the argument list.
argument types are: (ABleakwise , void (ABleakwise::)(AActor *OtherActor), FName)
object type is: FActorBeginOverlapSignature

I have seen other answers to this but they address components. Then, when I tried to add a third argument to the AddDynamic call, it says there are too many arguments. The internal add dynamic actual function is supposed to be creating a name for the method that is being binded. So why is it complaining that it did not receive a third item?

Any help would be great appreciated. Thanks so much. (Note: I am a noob to Unreal Engine and am working on version 4.12.5.)

The wiki entry is most likely out of date.

Taking a quick look at the FActorBeginOverlapSignature delegate in 4.13:

DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams( FActorBeginOverlapSignature, AActor*, OverlappedActor, AActor*, OtherActor );

So your function should be :

void ABleakwise::OnOverlap(AActor* OverlappedActor, AActor* OtherActor) { ... }

Should do the trick.

Thanks so much! That fixed the issue with “AddDynamic”. I was getting other errors, but that was because I forgot to prefix the function name with the class name in the source (cpp) file. (I am a C# stalwart and lover.) Thanks again. I really appreciate it.