Thanks man i fixed the issue by taking your advice, i moved all the code into one FNC
code that works:
void ARPGCharacter::TZ_Enter(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult)
{
if (!OtherActor->IsA(ACharacter::StaticClass())) // Checks to see if the other actor is not a character
{
GEngine->AddOnScreenDebugMessage(1, 5.f, FColor::Purple, "NON-PICKUP-CLASS"); // Displays a debug message
if(OtherActor->IsA(APickup::StaticClass()))
{
GEngine->AddOnScreenDebugMessage(1, 5.f, FColor::Yellow, "PICKUP CLASS");
APickup* CurrentPickup = Cast<APickup>(OtherActor); // Converts OtherActor form class Actor to Pickup
CurrentPickup->onPickedup(); // calls the Pickup class function onPickedup
}
}
}