Using this code below I get a, No Instance of overload function warning in Visual Studio, It can be hooked to elements in the unreal editor and blueprints though. It seems I’m missing something for it to work once played, as the UGameplayStatics works for ApplyPointDamage in this section, but not at these two locations for a muzzle element and hit element. Went to the Unreal Documentation for UGameplayStatics and am not immediately aware of what issue I’ve created. New to working in C++ and would love some assistance into whatever I seem to be missing.
FHitResult Hit;
if (GetWorld()->LineTraceSingleByChannel(Hit, EyeLocation, TraceEnd, ECC_Visibility, QueryParams))
{
// Blocking Hit! Process damage
AActor* HitActor = Hit.GetActor();
UGameplayStatics::ApplyPointDamage(HitActor, 20.0f, ShotDirection, Hit, MyOwner->GetInstigatorController(), this, DamageType);
if (ImpactEffect)
{
UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), ImpactEffect, Hit.ImpactPoint, Hit.ImpactNormal.Rotation());
}
}
DrawDebugLine(GetWorld(), EyeLocation, TraceEnd, FColor::White, false, 1.0f, 0, 1.0f);
if (MuzzleEffect)
{
UGameplayStatics::SpawnEmitterAttached(MuzzleEffect, MeshComp, MuzzleSocketName);
}