How do i Create a Audio off toggle

I have been struggling to figure out and find any resources on how to create a toggle on an avatar menu that turns off all audio attached to emotes, i am working on an avatar that has multiple dance emotes with music but would also like to be able to toggle said music off with a toggle because sometimes people dont want to hear the music and just see the dance or use a different song in whatever world. Any help is greatly appreciated .

My guess would be that in your noisy emotes, there is an AudioSource component that is being set to active. It seems the easiest solution would be to duplicate those emotes but remove the AudioSource .

Attach those emotes to a boolen (playEmoteSounds) then test that boolean in your animation controller. If the playEmoteSounds is true then transition to the noisy emote. If not, then transition to your edited quiet emote.

Without seeing how the sounds are actually being implemented, this is just a best guess, but the bottom line is that somewhere that AudioSource is being set to ‘active’ and you’ll just need to intercept where that’s happening, if that makes sense.

This is how I implemented them
image

There are a couple options.

The easiest would be to just duplicate that layer, remove the sound from the animation and add a new menu for the emotes with no sound so you can choose which one.

A more complicated option would be to duplicate each state in that animator, then set up your transitions based on a synced bool (eg. emoteSound).

Example transition pseudocode:

NoAudio --(Emote equals 1 AND emoteSound equals true)--> Dynamite
NoAudio --(Emote equals 1 AND emoteSound equals false)--> Dynamite(NoSound)

Then you could have an option in your emote menu to toggle that bool off/on.

1 Like