Unable to trigger OnActorBeginOverlap event

Hello, could somebody help me with OnActorBeginOverlap in C++ ?
It seems the event is not triggered when I use a BoxTrigger Actor (I’ve also tried with a trigger volume without success).
I would like to use an external actor for triggering event.
Regards.

Here is the code:

#pragma once

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

UCLASS(Blueprintable)
class ASC_API ALiftActor : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	ALiftActor();

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;

        // External collision volume from scene
	AActor* DownTriggerVolume;


	// Internal calcs
	APlayerController* PlayerController;

	void DownTriggerVolumeOnOverlapBegin(class AActor* OtherActor);
	void DownTriggerVolumeOnOverlapEnd(class AActor* OtherActor);

	UPROPERTY(EditAnywhere, Category = "Debug")
	bool IsInsideDownTriggerVolume;

	class UPointLightComponent* PointLight1;
	void ToggleLight();
};

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

#include "ASC.h"
#include "LiftActor.h"


// Sets default values
ALiftActor::ALiftActor()
{
 	// 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;
	
	PlayerController = nullptr;

	PointLight1 = CreateDefaultSubobject<UPointLightComponent>(TEXT("PointLight1"));
	PointLight1->Intensity = 3000;
	PointLight1->bVisible = true;
	RootComponent = PointLight1;

}


// Called when the game starts or when spawned
void ALiftActor::BeginPlay()
{
	Super::BeginPlay();
	
	PlayerController = UGameplayStatics::GetPlayerController(GetWorld(), 0);

	if (DownTriggerVolume != nullptr)
	{
		DownTriggerVolume->OnActorBeginOverlap.AddDynamic(this, &ALiftActor::DownTriggerVolumeOnOverlapBegin);
		DownTriggerVolume->OnActorEndOverlap.AddDynamic(this, &ALiftActor::DownTriggerVolumeOnOverlapEnd);

	}
}

void ALiftActor::ToggleLight()
{
	PointLight1->ToggleVisibility();
}
void ALiftActor::DownTriggerVolumeOnOverlapBegin(class AActor* OtherActor)
{
	UE_LOG(LogTemp, Warning, TEXT("Overlap detected!"));

	if (OtherActor == PlayerController)
	{
		ToggleLight();
	}
}

void ALiftActor::DownTriggerVolumeOnOverlapEnd(class AActor* OtherActor)
{
	if (OtherActor == PlayerController)
	{
		ToggleLight();
	}
}

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

}

Try using an SphereComponent or BoxComponent and remeber to set the InitSphereRadius/size.

Here is a link with an example: CPP Only Example | Unreal Engine 5.2 Documentation

Hello, thanks for your answer, but the thing is that:

  • it works if a use a component (but I want to use an actor from my scene)
  • it also works if I setup a ActorBeginOverlap event in my FPC blueprint (and for example play audio)

Are you setting the DownTriggerVolume size to small?

I’ve found out that I must prefix overlap callback declarations with UFUNCTION()
It now works.
Thanks for help