Hey!
I can’t seem to get the hit events to fire doing the exact same code as displayed in the session:
In Projectile.cpp:
void AProjectile::BeginPlay()
{
Super::BeginPlay();
ProjectileMesh->OnComponentHit.AddDynamic(this, &AProjectile::OnHit);
UE_LOG(LogTemp, Warning, TEXT("Begin Play"));
}
void AProjectile::OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
{
UE_LOG(LogTemp, Warning, TEXT("On Hit"));
}
In Projectile.h private:
UFUNCTION()
void OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);
It’s very short code and nothing complex, I went over this again and again and couldn’t find a difference from the instructor code, what am I missing here?
Thanks in advance