I’m trying to figure how to play an announcer sounds in UE4. This means it’s a non-positional, “fire and forget” sound.
I’m not sure which function to call (since all of them seem to rely on position data), and not sure how to make it global. I couldn’t find any NetMulticast functions on AGameMode, and I’m a bit confused where this should go.
Use UGameplayStatics::PlaySoundAttached function, attach the sound to the player and specify location as FVector::ZeroVector. That should help you achieve the effect you want.
Thank you Ogniok!
Do you recommend a way to make a template function for that? Or place it somewhere, where all connected players will get that call?
I assume that would require a NetMulticast function, but I’m not sure where to call it
Make a function(in example inside your GameMode) that will be replicated to all clients and call PlaySoundAttached inside. You can obtain a player actor reference from world context(GetWorld()->GetFirstPlayerController()->GetPawn()).
To learn more about networking in C++ I recommend looking at ShooterGame project.
Actually, I’m good with C++, I moved from the Source Engine to UE4. I was looking for the recommended or the best way of doing this.
Still, thank you! I thought the GameMode class shouldn’t use replicated/netmulticast functions, but apparently it can. I’ll give it a try tomorrow