Ways to generate OnOverlap in an Actor class?


I read different question and answers related why Components OverlapsEvent not generated, but no one solved my problem.

In C++ I try to register a delegate function to my StaticMeshComponent of my actor. On first look it compiles but OnOverlaps events are never generated if the ball and the paddle overlaps.

Header file:

#pragma once

#include "GameFramework/Actor.h"
#include "BallActor.generated.h"

class VOID_API ABallActor : public AActor

	UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = Ball)
	TSubobjectPtr<UStaticMeshComponent> BallStaticMesh;

	void OnConstruction(const FTransform &Transform) override;
	void Tick(float DeltaSeconds) override;

	void OnBeginOverlap(AActor *OtherActor, UPrimitiveComponent *OtherComponent, int32 OtherBodyIndex, bool bFromSweep, const FHitResult &SweepResult);

Source file:

#include "Void.h"
#include "BallActor.h"

ABallActor::ABallActor(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
	BallStaticMesh = PCIP.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("BallStaticMesh"));
	RootComponent = BallStaticMesh;

	static ConstructorHelpers::FObjectFinder<UStaticMesh> StaticMeshObj(TEXT("StaticMesh'/Game/Meshes/Ball/Ball.Ball'"));
	BallStaticMesh->StaticMesh = StaticMeshObj.Object;

	// register OverlapEvents
	BallStaticMesh->bGenerateOverlapEvents = true;
	TScriptDelegate<FWeakObjectPtr> delegateFunction;
	delegateFunction.BindUFunction(this, "OnBeginOverlap");

	// activate tick
	PrimaryActorTick.bCanEverTick = true;
	PrimaryActorTick.bStartWithTickEnabled = true;
	PrimaryActorTick.bAllowTickOnDedicatedServer = true;

void ABallActor::OnConstruction(const FTransform &Transform)


void ABallActor::Tick(float DeltaSeconds)

void ABallActor::OnBeginOverlap(AActor *OtherActor, UPrimitiveComponent *OtherComponent, int32 OtherBodyIndex, bool bFromSweep, const FHitResult &SweepResult)
	if (GEngine)
		GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, TEXT("In OnOverlap!"));

The UStaticMesh which is attached to the UStaticMeshComponent has sphere collision generated in the editor:


The paddle obj has a box collsion generated in the editor too. In the blueprints of the paddle and ball is “Generate Overlap Events” set to true.

Okay, I solved my error. facepalm

Forgot the UFUNCTION() before OnBeginOverlap

	void OnBeginOverlap(AActor *OtherActor, UPrimitiveComponent *OtherComponent, int32 OtherBodyIndex, bool bFromSweep, const FHitResult &SweepResult);