Audio-play

Thanks to this forum i was finally able to get teleports working so thank you so much, i have another issue i wish for help on, im making a school map for a rp and would like a button (cube) that upon interaction plays a audio throughout the map (school bell) would anyone know how to set up the graph for that ? thank you

I’m also new to this, but I got this working for me.
First make the button to click on, it can be a simple cube. The only thing you need to add to it is the ‘Audio source’ and an Udon behavior.
Second grab your sound of your school bell and put it into your assets folder. In my case I used a wav file from windows media folder.
Third, drop that file from the assets into the ‘Audio Clip’ (you can see Alarm 4 in mine), also disable the ‘play on awake’ or else it’ll play as soon as the world loads.
image

Fourth and finally, here’s the udon code to have the box play the sound. It references its own audio source and tells it to play.

If you want it to be a map wide thing, you can play with the audio source’s controls to make the sound extend or make udon behaviors that make the sound happen on other audio sources.

I tested this and it works (remember to turn up world volume) however it’s a local sound. I’m not quite sure how to make things global yet. Probably a synced variable that causes everyone to hear the sound.

Good luck!

1 Like

hi, first of all thank you for the information, i did exactly as you told however it still doesnt do anything

How about this? This was a solution for someone else too, The rolloff set to linear because the sound drops too quick on logarithmic rolloff. It might be working, just too quiet to hear.

To expand on this a little more, here’s how you can use an udon object to sync a sound for all players, so when one person interacts, it plays for everyone.

Hmmm this does not seem to work anymore ? I wonder if they have changed something.
Trying to play a sound across all players from a point (Gameobject)

Hey everyone! I am trying to get this to work myself. Any luck at all?

This is what I have - and while I get an interact prompt in world, nothing happens when I press the button.

application/vnd.unity.graphview.elements AM1X227bRhD9FYPPWmLvu2PAD66dBkbRJIhtvRSGsNxdumyopcGLXcHOl+Whn9Rf6EjyRZaURm1iwKAggMslNXN4LqO/v/x1m127eojZ/m+3WTnU9Ts3xZNs7NrKFXWcjD8enYcmHTXTaZNOUh/b0vnYncwX31zH1H+MPlbXsc1G2VAFvDUYxsAxR5x3lkiKX8CCIjpo41XQTFmGm6+aruqrJmX7t9mf2T4RADlnglHJpaVSwyib4TKXkEvDrQChlNTW6M+jLDUhnp8cd1h1ho96+lyMsrJubu6vXSx3jucNdosOh1T1s/fFH9H342Xbt1mVut4lH0+Os32KD+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