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 says all I need to do is:

Step 1: Declare It (in the header file)

//Bleakwise.h

UFUNCTION()
void OnOverlap(AActor* OtherActor)

Step 2: Define it

//Bleakwise.cpp

void ABleakwise::OnOverlap(AActor* OtherActor)
{

}

and finally Step 3: Bind it.

//Bleakwise.cpp

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

Unfortunately, this does not work. I get the error that: no instance of function template “FActorBeginOverlapSignature::__Internal_AddDynamic” matches the argument list. I have seen other answers to this but they address components.

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.)

Hi there,
I believe your problem lies in the fact this you are using a deprecated method.

The new version has a new parameter and should look like so:

void OnOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor);

There is a transition guide that I got this information from, It could be helpful to take a look, some of the answers on here are pre-4.12 and may be deprecated like this.

Transition Guide

Greetings and thanks for your answer. I tried that and it does not work. When I made the change and added “UPrimitiveComponent* OverlappedComponent” it still gave the same error. Any ideas?

Thanks, I really appreciate it.

The best way to insure that you have the right parameters is to look at the comparable use in your project. So, for example, if you’re working in one of the template projects, just do a search of OnActorBeingOverlap.

If I’m not mistaken, the complete function should look like

void OnOverlap(OverlappedComponent, AActor*, OtherActor, UPrimitiveComponent*, OtherComp, int32, OtherBodyIndex, bool, bFromSweep, const FHitResult &, SweepResult);

You’ll have to dd the variable names.

Also, once it does compile, make sure that bGenerateOverlapEvents is set to true.

First, thanks everyone for your insight. It pointed me in the right direction.

The function signature to bind to the OnActorBeginOverlap event should be: UFUNCTION() void OnOverlap(AActor* MyOverlappedActor, AActor* OtherActor);

I compiled it, and thank God it worked! Thanks again all!

Thanks for the insight.

Hello i know this is old post but i still have the same issue with unreal engine version 4.25