Closed sentyaanko closed 3 years ago
I'm not sure I understand the issue here. In Listen Server, GetPlayerController->IsLocalPlayerController
== MyTarget->GetOwner->CastToPlayerController->IsLocalPlayerController
for the local player. Listen server does not spawn a separate process. The local player is the Listen Server and we want the sound to play on them.
Any other players' PlayerControllers will not be considered "local".
Ah, I understand now what the issue is. The Listen Server player will hear the sprint sound for all simulated clients. Got it. Thank you!
When the
Net Mode
is set toPlay As Listen Server
and Sprint is executed on the client side, the Listen Server will play the sound on the RootComponent of Pawn, which is controlled by the Listen Server itself.Currently,
GetPlayerController->IsLocalPlayerController
is used to determine if sound should be played or not.OnRemove
andOnActive
receiveMyTarget
, so I suggest usingMyTarget->GetOwner->CastToPlayerController->IsLocalPlayerController
.