UI Toggle Button?

Has Unity added toggle buttons yet?
For example ON/OFF music switch etc, had to make own last time.
Anything changed,this is common needed UI feature?

@MrEsquire :

Hi, isn’t Toggle Component good for what you need?

I’ve just used an custom script using new UI system IPointerDown / Up and stored the state value and run some image swapping based on that state, most likely you’ve used something similar I guess.

1 Like

Second time I’m agreeing with @eses today.

Yes if you need an on / off toggle style button, then you just need to use the toggle control. Just replace the Background and Checkbox images with your button on/off states and place them accordingly in the UI.

You could use the event interfaces as suggested but for just a toggle, it’s probably overkill unless you need more flexibility from the toggle. Also don’t forget the ToggleGroup if you have a few toggles and only want one on at a time.

3 Likes