Audio play from udon?

I’ve been trying to get audio to play through Udon for some time now and I can’t quite figure out what I’m doing wrong.


Here is the way I’m trying to tackle it, playing a oneshot audioclip through the audiosource attached to the object, which also has the udon attached.

Heres the script coming before it in case it matters, which activates an open/closing motion through a boolean in the animator, which works fine.

3
This is the current components setup on the object, soundwise

and this is what my audiosource looks like

Any suggestions here?

I got 4 suggestions for you, I just did this myself.

  1. Make sure your world volume is up in the game (I say that cause I made that mistake =) )
  2. Change the audio source ‘Volume Rolloff’ to ‘Linear Rolloff’ which will give it a louder sound if you’re not immediately ontop of it (I think)
  3. Not sure about using a public variable to access it’s own audio source, here’s how I did mine, it just looks at itself for the audio source.
  4. You could make just 2 audio sources with built in audio clips instead of dynamically changing it to keep things simpler.

All this is speculation from a noob since I just got on Udon myself. Good luck!

Hey, you were totally right! The logarithmic rolloff from the sound made it so quiet it couldn’t be heard, and there was actually nothing wrong with my script in the first place!

tbh I like to keep my variables public in udon, just so I can see them better haha.
I also really like the function “audio source play one shot” because it allows me to assign a simple variable for an audioclip and call it from the same audiosource.

Glad this was a productive experience!

If you would like to add my discord, reach out as well! We can work through this new environment together and get better haha.

1 Like