Begin overlap is working fine, but I can’t get end overlap to trigger.
.h file:
UPROPERTY(VisibleAnywhere, Category = "Default")
UBoxComponent* BoxCollision = nullptr;
UFUNCTION()
void OnOverlapBegin(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult &SweepResult);
UFUNCTION()
void OnOverlapEnd(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);
.cpp file - constructor
BoxCollision->bGenerateOverlapEvents = true;
BoxCollision->OnComponentBeginOverlap.AddDynamic(this, &ADisplacementTankSlot::OnOverlapBegin);
BoxCollision->OnComponentEndOverlap.AddDynamic(this, &ADisplacementTankSlot::OnOverlapEnd);
.cpp functions
void ADisplacementTankSlot::OnOverlapBegin(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult &SweepResult)
{
UE_LOG(LogTemp, Warning, TEXT("OVERLAP BEGIN"));
}
void ADisplacementTankSlot::OnOverlapEnd(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex)
{
UE_LOG(LogTemp, Warning, TEXT("OVERLAP END"));
}