Download

Need help with OnComponentBeginOverlap Delegate

I was wondering if there is a way to shorten out this code:


void ABaseEnemy::ProximityTriggerBoxOverlapped(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
if(Cast<ABaseCharacter>(OtherActor))
UE_LOG(LogTemp, Warning, TEXT("ProximityBox Overlapped"));
}

It’s a definition that simply logs out if a BaseCharacter overlaps the collision;

I just want to know if there is a way to keep the functionality brought on by what’s marked in bold without having to use the large default signature or if I could override the signature but keep the same functionality:


ProximityTriggerBox->**OnComponentBeginOverlap**.AddDynamic(this, &ABaseEnemy::ProximityTriggerBoxOverlapped);