so i get a error on BoxComponent->OnComponentBeginOverlap.AddDynamic(this, &UOnPress::OnCollision);
and i really do not know why, i hope someone can help me
error:
Error (active) E0304 no instance of function template “FComponentBeginOverlapSignature::__Internal_AddDynamic” matches the argument list InputOutput
line 15 OnPress.cpp file
this is my OnPress.h file
#pragma once
#include "Runtime/Engine/Classes/Components/BoxComponent.h"
#include "Runtime/CoreUObject/Public/UObject/UObjectGlobals.h"
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "OnPress.generated.h"
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class INPUTOUTPUT_API UOnPress : public UActorComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UOnPress();
protected:
// Called when the game starts
virtual void BeginPlay() override;
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
private:
UBoxComponent * BoxComponent;
UPROPERTY(EditAnywhere)
AActor *Keyboard;
UPROPERTY(EditAnywhere)
int id;
UFUNCTION()
void OnCollision();
};
this is my OnPress.cpp file
#include "OnPress.h"
// Sets default values for this component's properties
UOnPress::UOnPress()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don't need them.
PrimaryComponentTick.bCanEverTick = true;
BoxComponent = CreateDefaultSubobject<UBoxComponent>(FName("BoxComponent"));
BoxComponent->bGenerateOverlapEvents = true;
BoxComponent->OnComponentBeginOverlap.AddDynamic(this, &UOnPress::OnCollision);
}
// Called when the game starts
void UOnPress::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void UOnPress::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
// ...
}
void UOnPress::OnCollision()
{
}