Overlapping doesn' happen

What I want is, When player is overlapping with DangerZone, give him some messages.

I made OnActorBeginOverlap function in “Zone” class and “DangerZone” is child class of " Zone" class.

No VS or UE4 errors but also No Overlapping happens.

Is there any problems to c++ codes? or what should I check?

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

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "GameplayTagContainer.h"
#include "Components/BoxComponent.h"
#include "Zone.generated.h"

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

	UPROPERTY()
	UBoxComponent* CollisionMesh;

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;

	// Use Only once at beginplay and in Editor
	UFUNCTION(BlueprintInternalUseOnly)
		void SetZoneNameTag();

	UFUNCTION()
	virtual void OnActorBeginOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
	
	// Do not access and change
	UPROPERTY(BlueprintReadOnly)
		FName ZoneName;
	
};

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


#include "Zone/Zone.h"

// Sets default values
AZone::AZone()
	: ZoneName{}
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = false;
	CollisionMesh = CreateDefaultSubobject<UBoxComponent>(FName("Collision Mesh"));
	SetRootComponent(CollisionMesh);	
}

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

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

}

void AZone::OnActorBeginOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
	
		GEngine->AddOnScreenDebugMessage(-1, 5,FColor::Red,"Success");	
}



// DoN Call Except RightAfter BeginPlay. This Must be call once.
void AZone::SetZoneNameTag()
{
	ZoneName = FName("ZoneName."+this->GetName());
	Tags.Add(ZoneName);
	GEngine->AddOnScreenDebugMessage(-1, 5, FColor::Red, ZoneName.ToString());
}

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

#pragma once

#include "CoreMinimal.h"
#include "Zone.h"
#include "DangerZone.generated.h"

/**
 * 
 */
UCLASS()
class LOC_API ADanerZone : public AZone
{
	GENERATED_BODY()

};

It seems you never bind the OnActorBeginOverlap function to the event and you don’t tell BoxComponent to generate the events. Add this to the end of the AZone constructor:

BoxComponent->SetGenerateOverlapEvents(true);
OnActorBeginOverlap.AddDynamic(this, &AZone::OnActorBeginOverlap);

Hope this helps

Sorry, in my answer I meant “CollisionMesh” instead of “BoxComponent”

I think OnActorBeginOverlap is a blueprint event, not a c++ method you can override. Try adding your overlap function as a delegate to the CollisionMesh like so:

CollisionMesh->OnComponentBeginOverlap.AddDynamic( this, &AZone::OnActorBeginOverlap);

You might have to change the signature of AZone::OnActorBeginOverlap to match OnComponentBeginOverlap though.