UdonBetterPlayerAudio v.0.4
Demo: https://twitter.com/GuriboVR/status/1371191149742940164
Fixes
- fixed issue with multiple microphones being used at the same time
previously all but the last user stopped being affected as soon as someone else picked up another microphone
Features
-
added BetterPlayerAudioOverride component
-
one such component can be used to override the settings for one or many players
This allows having effects like occlusion when e.g. using a microphone. The previous method of ignoring players is additionally still available as an alternative.
-
for each player only one override can be active
Adding a player to another override and applying this new override using
betterPlayerAudio.OverridePlayerSettings(...)
will replace the existing override for this player
Code example for one player being affected by the microphone (full example can be found here):
// adding a player to be affected by the current override var newMicUser = VRCPlayerApi.GetPlayerById(newUser); if (!Utilities.IsValid(newMicUser)) { return; } if (Utilities.IsValid(betterPlayerAudioOverride)) { betterPlayerAudioOverride.AffectPlayer(newMicUser); } playerAudio.OverridePlayerSettings( betterPlayerAudioOverride); // removing a player from the current override var currentMicUser = VRCPlayerApi.GetPlayerById(oldUser); if (Utilities.IsValid(currentMicUser)) { if (Utilities.IsValid(betterPlayerAudioOverride)) { betterPlayerAudioOverride.RemoveAffectedPlayer(currentMicUser); } playerAudio.ClearPlayerOverride(currentMicUser.playerId); }
-
-
example scenes were updated to use the new system
Notes
Special thanks goes to Niyah for suggesting the idea of microphones being affected by occlusion.