Ive been working from the tutorial A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums.
In there, there is a UsableItem > PickupItem > ConsumableItem.
The “PickupItem” class has logic to play a sound que at location which works like so:
UGameplayStatics::PlaySoundAtLocation(this, PickupSound, GetActorLocation());
It works, but when I have multiplayer viewports open I notice the sound only plays on the “Preview Server” viewport, It does not play the sound inside the “Preview Client”. I can also pick up the item with the Client player but I can only hear the sound playing in the “Preview Server” viewport.
As a workaround Ive tried placing the, “PickupSound” sound que inside an AudioComponent. I Initialize the AudioComponent, and tried to replace the “PlaySoundAtLocation” in the OnUsed function like so:
//UGameplayStatics::PlaySoundAtLocation(this, PickupSound, GetActorLocation());
if (PickupSound)
{
AudioComp->SetSound(PickupSound);
AudioComp->Play();
}
But this is even worse, as nothing plays when trying to activate the sound this way, not in Client nor Server viewports.
For settings Ive checked the box in Editor Preferences > Play > Create Audio Device for Every Player
Im not sure what to do next aside from rebuilding everything over again, but I cannot see anything in the code that I would do differently especially in those few files that create the item.
Anyone have an idea of what might be going on and what I can do?