Creating a Mute Button

Hi guys, I've ran into a bit of a snag with my custom mute button I've been adding to my projects. The theory of working one is as follows:

Object Sound On/Off has 2 states: Normal and Muted

Sound On/Off Boolean variable created = true (on) by default.

Change state of Sound On/Off to Muted when user clicks.

Change state of Sound On/Off to Normal when user clicks IF state of Sound On/Off is Muted.

When state is/changes to Muted, Sound On/Off variable = false (off)

When state is/changes to Normal, Sound On/Off variable = true (on)

 

In theory this all works. But I can't get the state to reset back to normal. I click the object and the state changes to muted and the variable changes to false, but when I click again nothing happens. Variable doesn't change and the state doesn't change.

 

Any suggestions guys? Or any better ways to do this? (I'm trying to not use the player and use a custom UI)

 

Cheers.

1 Reply