Why is IsA not working?

Hi, I just want to be able to check if a collided actor is of a certain type, I’ve researched around it, and used the exact syntax, but it isn’t working. Has something changed?

void AEnemy::onHit(class UPrimitiveComponent* OverlappingComp, class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
	if (OtherActor->IsA(ACPUExerciseProjectile::StaticClass))
	{
		UE_LOG(LogTemp, Log, TEXT("COLLIDED CORRECTLY"));
	}
	else
	{
		UE_LOG(LogTemp, Log, TEXT("COLLIDED INCORRECTLY"));
	}
}

Maybe there is should be
OtherActor->IsA(ACPUExerciseProjectile::StaticClass())