I know there is a Toggle, but it’s designed to work as a checkbox, where an additional graphic is either shown or hidden on top of the main button shape. I rather need a way to highlight the actual button shape when it is toggled on, and revert to normal mode when it is turned off.
It would be really great if another “Toggled” color state is added to the regular Toggle class, so the Toggle could serve both purposes.
What do you think?
Yes, I think Unity should add this to their list of standard ui containers.
That being said, I made a simple one not too long ago. I have a fair amount of ui stuff I would like to share at some point, but for now here’s the toggle:
public class ToggleButton : MonoBehaviour
{
public Text text;
public string pressedText;
public string unpressedText;
public void OnToggle(bool state)
{
if (state)
{
text.text = pressedText;
}
else
{
text.text = unpressedText;
}
}
}
I add that class to a standard toggle. Then see the attached for the hierarchy. There’s an overlay and a standard background. The overlay is a darker color whereas the background the typical background I want.
You can see on the attributes, I have the background as the transition image and then the overlay as the graphic. When you click on the “button” it gets darker and also changes the text (calling the OnToggle).
It’s not super exciting but only took me a few mins to create and I think that says something about the awesomeness of Unity!


Thanks!
That’s what I’ll probably use for now. What bothers me a bit is that this adds to the overdraw, and my UI is already kind of heavy. I really hope Unity will add a separate color state for the toggle.