How to make an mute/unmute button?

Hi everyone!
I want to make a button in unity that mutes/unmutes the music and sfx.
I have 3 buses for the settings in the game, one for sfx, one for music and the other for the master.
I thought about making a snapshot that lowers the master vca, but how can I apply it in unity?
Thanks a lot!

You’re on the right track. Assign all the necessary group buses into the necessary VCAs and then use FMODUnity.RuntimeManager.GetVCA to get the VCA and VCA::setVolume() to set the volume of the VCA (0 to mute, 1 to set back to default volume level).

https://www.fmod.com/resources/documentation-unity?version=2.02&page=api-runtimemanager.html#getvca

https://www.fmod.com/resources/documentation-api?version=2.02&page=studio-api-vca.html#studio_vca_setvolume

2 Likes

Thanks a lot!!

@richard_simms I also found your info useful! Is there a practical way to do the opposite with a Solo button, and by that I mean:

  • I have various sounds (FMOD events with Programmer Instruments) playing that are in one (or more) mixer groups
  • I want to press a button in the game that MUTES all the other sounds, so it should be able to detect what everything else is in a group
  • It should not mute certain other mixer groups, such as system UI sounds, and the like.

Basically the in-game equivalent of pressing a SOLO button in an FMOD event track. What might the logic for this look like, or is it considerably trickier?

Unfortunately, it is a little trickier, as the API has no “Solo” functionality - any implementation of what you want will require some kind of enumeration of buses. This could either be done at design time in Studio, for example by automating bus faders with parameters or setting up VCAs that affect specific buses to the exclusion of other, or at runtime by enumerating your buses with Studio::Bank::getBusList and muting/unmuting as needed with Studio::Bus::SetMute.

1 Like

Acknowledged and thanks for confirming. I thought as much but didn’t want to assume — so your precise info is valuable!