I am trying to get my game to spawn a particle effect when a bullet collides with an object. The particles do spawn when running in singleplayer, however no emitter is spawned when running on a dedicated server. If I test it as a listen server, the emitter only spawns on the host.
// Trace from old position to new position and test for collision
FHitResult HitResult(ForceInit);
bool HitSuccess = GetWorld()->LineTraceSingle(HitResult, ActorLocation, NewActorLocation,
ECC_Visibility, TraceParams);
if (HitSuccess)
{
// Bullet hit something
ClientNotifyHit(HitResult);
Destroy();
}
Then in the ClientNotifyHit
void ATOBullet::ClientNotifyHit_Implementation(const FHitResult Hit)
{
FVector ParticleLoc = Hit.ImpactPoint + (Hit.ImpactNormal * FVector(32.f, 32.f, 32.f));
UGameplayStatics::SpawnEmitterAtLocation(this, ImpactParticle, ParticleLoc,
Hit.ImpactNormal.Rotation());
}
ImpactParticle
is set in the Blueprint for the bullet.