Blueprint overriden functions - default c++ behavior not working

Hi guys, I just started using UE4 a week or two ago and am trying to get a very basic project going to familiarize myself with the engine, tools and C++ API… I’ve defined a basic class that inherits from Actor and wanted to describe some default behaviour for a few events. I then wanted to be able to override this in Blueprint using custom events. My issue seems to be that the default behaviour I define in my C++ class doesn’t seem to work so I’m wondering what I could be doing wrong…

My header file contains

// On Overlap implementation
UFUNCTION(BlueprintNativeEvent)
void MyOnBeginOverlap(AActor* MyOverlappedActor, AActor* OtherActor);
void MyOnBeginOverlap_Implementation(AActor* MyOverlappedActor, AActor* OtherActor);

// On End Overlap implementation
UFUNCTION(BlueprintNativeEvent)
void MyOnEndOverlap(AActor* MyOverlappedActor, AActor* OtherActor);
void MyOnEndOverlap_Implementation(AActor* MyOverlappedActor, AActor* OtherActor);

In my C++ class I define my two functions

void AHybridSphere::MyOnBeginOverlap_Implementation(AActor* MyOverlappedActor, AActor* OtherActor)
{
	FString outputString;
	outputString = "Hello From C++!";
	Text->SetText(FText::FromString(outputString));
}

void AHybridSphere::MyOnEndOverlap_Implementation(AActor* MyOverlappedActor, AActor* OtherActor)
{
	Text->SetText(NSLOCTEXT("AnyNS", "Any", "Goodbye From C++"));
}

And in my class constructor I’ve included

OnActorBeginOverlap.AddDynamic(this, &AHybridSphere::MyOnBeginOverlap);
OnActorEndOverlap.AddDynamic(this, &AHybridSphere::MyOnEndOverlap);

When I move my player to overlap with my actor the text component does not change it’s text so I’m wondering what I’m doing wrong…

Cheers!

Fixed it by moving

OnActorBeginOverlap.AddDynamic(this, &AHybridSphere::MyOnBeginOverlap);
 OnActorEndOverlap.AddDynamic(this, &AHybridSphere::MyOnEndOverlap);

from the constructor to the BeginPlay fuction… I’m not sure why but there you go. Hope it helps people having similar problems.

Thank you! I must be doing the exact same tutorial (and boy does that book have typos!) and I was having the same problem. I think it might be some sort of interaction between BlueprintNativeEvent, constructors and BeginPlay. I don’t know, but maybe what happens is that there’s a special path for BlueprintNativeEvents. The constructor sets it up, then the engine does a clean up or something and overrides what was set in the constructor, and finally when BeginPlay executes everything gets set to what it should be.