Hi! I’m running into a weird issue.
I have two different pickups, a HealtPickup and a PointsPickup.
Both have the same OnBeginComponentOverlapEvent, but only the Points Pickup is being triggered.
I don’t know why it’s behaving this way.
Does someone had this issue/can help me with this ?
UPDATE:
the methods addPoints() is not being triggered, but the Destroy method is.
PointsPickup:
void APointsPickup::OnBeginOverlapComponentEvent(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSwep, const FHitResult& SweepResult)
{
//check if the cast is successful, if it is, then call AddPoints from
//PlayerCharacter and set the remaining pickups
APlayerPaperCharacter* PlayerChar = Cast<APlayerPaperCharacter>(OtherActor);
if (IsValid(PlayerChar)) {
PlayerChar->AddPoints(PointsValue);
Destroy();
}
}
HealthPickup:
void AHealthPickup::OnBeginOverlapComponentEvent(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,PrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSwep, const FHitResult& SweepResult)
{
//check if the cast is successful, if it is, then call SetHealth from
//PlayerCharacter
APlayerPaperCharacter* PlayerChar = Cast<APlayerPaperCharacter>(OtherActor);
if (IsValid(PlayerChar)) {
PlayerChar->AddHealth(HealthValue);
Destroy();
}
}