AddDynamic doesn't match the argument list

Hi everyone, I am new to unreal engine c++ programming and I am getting this error when trying to add an overlap dynamic to my game, currently the script is:

Code:

// Fill out your copyright notice in the Description page of Project Settings.


#include "FlorSwitch.h"

// Sets default values
AFlorSwitch::AFlorSwitch()
{
     // Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
    PrimaryActorTick.bCanEverTick = true;

    TriggerBox = CreateDefaultSubobject<UBoxComponent>(TEXT("TriggerBox"));
    RootComponent = TriggerBox;

    TriggerBox->OnComponentBeginOverlap.AddDynamic(this, &AFlorSwitch::OnOverlapBegin);
    TriggerBox->OnComponentEndOverlap.AddDynamic(this, &AFlorSwitch::OnOverlapEnd);

    FloorSwitch = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("FloorSwitch"));
    FloorSwitch->SetupAttachment(GetRootComponent());

    Door = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Door")); 
    Door->SetupAttachment(GetRootComponent());

}

// Called when the game starts or when spawned
void AFlorSwitch::BeginPlay(){
    Super::BeginPlay();

}

// Called every frame
void AFlorSwitch::Tick(float DeltaTime){
    Super::Tick(DeltaTime);

}

void AFlorSwitch::OnOverlapBegin(
        UPrimitiveComponent OnComponentBeginOverlap, 
        UPrimitiveComponent* OverlappedComponent, 
        AActor* OtherActor,
        UPrimitiveComponent* OtherComp, 
        int32 OtherBodyIndex, 
        bool bFromSweep, 
        const FHitResult& SweepResult
    ){
    UE_LOG(LogTemp, Warning, TEXT("OverLap Begin"))
}

void AFlorSwitch::OnOverlapEnd(
        UPrimitiveComponent OnComponentEndOverlap,
        UPrimitiveComponent* OverlappedComponent,
        AActor* OtherActor,
        UPrimitiveComponent* OtherComp,
        int32 OtherBodyIndex
    )
{
    UE_LOG(LogTemp, Warning, TEXT("OverLap End"))
}

And this is the error log:

Error (active) E0304 no instance of function template “FComponentBeginOverlapSignature::__Internal_AddDynamic” matches the argument list line 15

Error (active) E0304 no instance of function template “FComponentEndOverlapSignature::__Internal_AddDynamic” matches the argument list line 16

Error Missing ‘*’ in Expected a pointer type MyProject line 41

If anyone can help my thanks in advance.

Hi, have a look at the documentation. I don’t think your function argument list (line 38-45 is correct). Remove the first argument and see if that clears the error given in the output log! I’m not at desktop computer so can’t test it, but let me know and I can help you further if needed!

Thank you very much I’ll test it immediately thank you for responding :D.

You were right thank you very much

Mark answer as complete for people with the same issue!