How to play sound only at a certain distance?
I have Audio Source. On certain events, the sound is played through the function:
[PunRPC] private void PlaySound() {
GetComponent<AudioSource>().PlayOneShot(shootSound);
}
And then this function is called via
photonView.RPC(nameof(PlaySound), RpcTarget.AllBufferedViaServer);
And here's the problem: If you use this method, then the sound will be played simultaneously for all players, throughout the game map, but it needs to be played at a certain distance.
If you use this function without RPC, then everything seems to work, but then this sound is not synchronized.
In the sound settings, I made the minimum distance 1, and the maximum 20.
Best Answer
-
This is very stupid, but it turns out I just forgot to change the Spatial Blend. Problem solved. sorry for the stupid question
0
Answers
-
This is very stupid, but it turns out I just forgot to change the Spatial Blend. Problem solved. sorry for the stupid question
0 -
Glad you found it. No worries, this happens :)
0