OnComponentBeginOverlap not working [C++]

Trying to create a valuable that can be picked up by the player, however I can’t get OnComponentBeginOverlap to work.
VALUABLE.H:

   #include "GameFramework/Actor.h"
    #include "Valuable.generated.h"
    
    UCLASS()
    class FANTASY8BIT_API AValuable : public AActor
    {
    	GENERATED_BODY()
    	
    public:	
    	// Sets default values for this actor's properties
    	AValuable();
    
    	// Called when the game starts or when spawned
    	virtual void BeginPlay() override;
    	
    	// Called every frame
    	virtual void Tick( float DeltaSeconds ) override;
    
    
    protected:
    	// Overlap event that is called when player collets valuable
    	UFUNCTION(BlueprintCallable, Category = "Valuable")
    	void onPickUp(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
    
    	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Valuable", meta = (AllowPrivateAcces = "true"))
    	USphereComponent* collisionSphere;
    
    };

VALUABLE.CPP:

#include "Fantasy8bit.h"
#include "PaperFlipbookComponent.h"
#include "Valuable.h"


// Sets default values
AValuable::AValuable()
{
 	// 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;
	collisionSphere = CreateDefaultSubobject<USphereComponent>(TEXT("Collision Sphere"));
	RootComponent = collisionSphere;
	

	// Bind a call to onPickUp function when sphere is being overlapped
	collisionSphere->OnComponentBeginOverlap.AddDynamic(this, &AValuable::onPickUp);
}

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

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

}

void AValuable::onPickUp(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
	if (OtherActor != nullptr && GetWorld() && OtherActor == UGameplayStatics::GetPlayerCharacter(GetWorld(), 0))
	{
		Destroy();
	}

}

This code gives the following error when compiled:

CompilerResultsLog:Error: Error D:\MyWork\UnrealEngine4_Projects\Fantasy8bit\Source\Fantasy8bit\Valuable.cpp(20) : error C2664: 'void TBaseDynamicMulticastDelegate<FWeakObjectPtr,void,UPrimitiveComponent *,AActor *,UPrimitiveComponent *,int32,bool,const FHitResult &>::__Internal_AddDynamic<AValuable>(UserClass *,void (__cdecl AValuable::* )(UPrimitiveCompone
nt *,AActor *,UPrimitiveComponent *,int32,bool,const FHitResult &),FName)': cannot convert argument 2 from 'void (__cdecl AValuable::* )(AActor *,UPrimitiveComponent *,int32,bool,const FHitResult &)' to 'void (__cdecl AValuable::* )(UPrimitiveComponent *,AActor *,UPrimitiveComponent *,int32,bool,const FHitResult &)'

CompilerResultsLog:Error: Error D:\MyWork\UnrealEngine4_Projects\Fantasy8bit\Source\Fantasy8bit\Valuable.cpp(20) : note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

Any help is appreciated, thank you!

Seriously ? Isn’t it enought ? :smiley:

cannot convert argument 2 from
    -> 'void (__cdecl AValuable::* )(AActor *,UPrimitiveComponent *,int32,bool,const FHitResult &)' to
    ->'void (__cdecl AValuable::* )(UPrimitiveComponent *,AActor *,UPrimitiveComponent *,int32,bool,const FHitResult &)'

I changed the function arguments to:

void AValuable::onPickUp(class UPrimitiveComponent* Comp, class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)

It now compiles! However the function is for some reason not called when the collision sphere is overlapped.

Make sure Collision Profile Name is correctly set and Generating Overlap Events is enabled

	CollisionSphere->SetCollisionProfileName(TEXT("OverlapAll"));
	CollisionSphere->bGenerateOverlapEvents = true;

Was hoping this would work, but nope…
Know that for a fact since I use:
UE_LOG(LogTemp, Warning, TEXT(“Function called”));
But nothing is written to the output log.

I used OnActorBeginOverlap instead, now everything works as expected