AddDynamic Overlap Issue

Having an issue with AddDynamic. Here’s the code.

UFUNCTION in header file

UFUNCTION()
		void OnActorOverlap(class UPrimitiveComponent* OverlappingComp, class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);

In the .cpp

tBox = CreateDefaultSubobject<UBoxComponent>(TEXT("Root"));
	tBox->bGenerateOverlapEvents = true;
	//tBox->OnComponentBeginOverlap.__Internal_AddDynamic(this, &AmyActor::OnOverlap, OnOverlap);
	
	tBox->OnComponentBeginOverlap.AddDynamic(this, &AmyActor::OnActorOverlap);

Attached is the following error within visual studio

I get

Error: No instance of function template “FComponentBeginOverlapSignature::__Internal_AddDynamic” matches the argument list argument types are (ClassName , void (ClassName::)(UPrimitiveComponent *OverlappingComp, AActor *OtherActor), FName)
object type is: FComponentBeginOverlapSignature

I’m rather new to C++ & Unreal, thanks for looking over and any recommended books would be greatly appreciated

Hi, try this function signature for the function you’re trying to add dynamically instead. Not sure if you need to forward declare, so if it doesn’t work you can add “class” to the needed function members.

void OnActorOverlap(AActor* otherActor, UPrimitiveComponent* otherComp, int32 otherBodyIndex, bool bFromSweep, const FHitResult& sweepResult);