Toggle: Missing "Selected"-Color

The toggle script exposes colors for

Normal
Highlighted
Pressed
Disabled

but where is: Selected?

And - how can we change these colors by script?

Same problem here!
I’m trying to change text color when Toggle is on using Animation but I can’t.

  • About change colors by script you can use Toggle’s Intercepted Events.
    The only way I could use was inheriting Toggle class instead MonoBehaviour and overriding Selectable methods:
public virtual void OnDeselect(BaseEventData eventData);
public virtual void OnMove(AxisEventData eventData);
public virtual void OnPointerDown(PointerEventData eventData);
public virtual void OnPointerEnter(PointerEventData eventData);
public virtual void OnPointerExit(PointerEventData eventData);
public virtual void OnPointerUp(PointerEventData eventData);
public virtual void OnSelect(BaseEventData eventData);

This works:

GetComponent(UI.Text).color = myColor;
GetComponent(UI.Toggle).colors.highlightedColor = myColor;

1 Like