Detecting Root Component Overlap.

I’m trying to create a class that triggers when a pawn reaches it (overlaps). However I can’t get the OnComponentBeginOverlap to work. No “Triggered” message is ever displayed. Any thoughts?

In Header.

UFUNCTION()
void OnOverlapBegin(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);

Function Def

void ADestinationGoal::OnOverlapBegin(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT(“Triggered”));

triggered = true;

}

In the constructor.

UBoxComponent* rootBox = CreateDefaultSubobject<UBoxComponent>(TEXT(“RootComponent”));
rootBox->InitBoxExtent(goalSize);
rootBox->SetCollisionProfileName(TEXT(“OverlapOnlyPawn”));
rootBox->OnComponentBeginOverlap.AddDynamic(this, &ADestinationGoal::OnOverlapBegin);
RootComponent = rootBox;

Well nevermind. Not sure why but its working now. I literally did nothing other than close the editor… the next time I openned it… it worked… go figure.

It’s because when adding/removing UFUNCTION() or UPROPERTY() in the header files, your editor needs to close in order for the newly modified codes be put into the dynamic link libraries (DLL) and be visible to the editor. Hot reloading the DLLs does not, I think, remove the old references that are missing from the source code.

Ahhh. Thanks so much. Explains a great number of issues I’ve had.

As far as I know and as I understand the release notes, hot reload does exactly this . (Unreal Engine 4.5 Released! - Announcements and Releases - Unreal Engine Forums
So there should be no need to restart the editor manually. In addition it always works for me without doing so .

Then it means something is broken along the way from 4.5 to 4.7. I need to restart the editor whenever I add a new UFUNCTION() or UPROPERTY().