Dynamically changing the look of a button

So i got this button and i use the targetGraphic in its basic way to set the back color, like a button does.
However, i also want icons per button and i want to do things like change the color of the icon or make the button text move a little and those things when the button is hovered or selected.

The only event is onClick. How do i do these things in Unity? Watching for property changes in LateUpdate() seems like horrible design, at least it would be in any desktop or app ui framework.

Have a nice weekend :slight_smile:

Any best practices ressources i should know about?

You can add the EventTrigger component and choose different events.

Add PointerEnter and drag in a gameobject with an Image component to turn on/off. Then do the opposite on PointerExit.

Or put a custom script on any element that uses the interfaces from here - Namespace UnityEngine.EventSystems | Unity UI | 1.0.0

1 Like

Nice, thank you!