This is part bug report and part feature request. The VRCPlayAudio component has been a very liberating addition to the SDK. Effectively functioning like a soundbank.
A very niche issue I have come across when developing a semi-auto gun for an avatar of mine - is that the audio source has to be
empty
by default, with the
AudioClip
Being set to
None (Audio Clip)
, and the gameobject always toggled on. VRCPlayAudio will populate the
AudioClip
with a sound when it passes a state in the animator.
However, when the animator exits a state, VRCPlayAudio doesn't have the ability to
CLEAR
the Audio Source. A problem this creates is the sound is then permanently stuck in the Audio Source until replaced by another, meaning every time I toggle my object on and off (one that required playonawake to work), it will play the sound.
In this video, the Audio Source
Shoot_TimeCrisis_Wind
starts out blank. When the
M1911
Game object is toggled on and off, it doesn't play any sound. Shooting the gun will populate the Audio Source with a gunshot sound. Now, toggling the
M1911
on and off will play the gunshot sound
every time
because the audio source isn't being cleared.
In the animator however, you can
make
a VRCPlayAudio component just be
blank.
, and point to your audio source. This will clear your audio source correctly in editor, and functions how it should. With the audio source clear, it toggling on and off my
M1911
does not play a gunshot sound unintentionally.
Example video of how clearing audio source should work:
https://files.catbox.moe/vrspbn.mp4
... However, a major problem in doing this, is now that there is an
empty
VRCPlayAudio Component in your animator. The SDK will now get completely
stuck
in an infinite loop attempting to scan the files present in the avatar, and preventing upload.
Example of the SDK getting stuck on Validating:
https://files.catbox.moe/ohn1o4.mp4
Ideally, a solution to this would just come in the form of adding a dropdown to VRCPlayaudio that specifically clears an audio source, or dedicated component that handles this function exclusively. An alternative solution I came up with is having a null.mp3 file insert into the audio source instead. Whilst this does work, this is however still an audio clip being
played.
Contributing to the voice limit even if briefly - so it isnt an elegant one.