Operand types are incompatible ("AActor *" and "ACharacter *") error

I have this code from a course but I get the error

operand types are incompatible
(“AActor *” and “ACharacter *”)

void Apickup::OnPickedUp(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
	if (OtherActor == UGameplayStatics::GetPlayerCharacter(this, 0)) {
		Destroy();
	}
	
}

I think you might be missing include to ACharacter class GameFramework/Character.h

1 Like