I’m not pretty sure with the tutorial over internet. But, i’m new with unity. I have 2 button, music off and music on, so i want to combine as one button to mute all the sound in my game, how i do it? I’m not pretty sure the code. I already created 2 guitexture, and now i’m lost how to implement the code. I hope you guys can help me. Thanks!
isMute = ! isMute;
Don’t forget your semicolon!
Code to use. Simply add Mute to the OnClick listener on your button.
bool isMute;
public void Mute (){
isMute = ! isMute
AudioListener.volume = isMute ? 0 : 1;
}