Search Unity

Dynamically changing the look of a button

Discussion in 'UGUI & TextMesh Pro' started by CortiWins, Jan 8, 2021.

  1. CortiWins

    CortiWins

    Joined:
    Sep 24, 2018
    Posts:
    150
    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 :)
     
  2. CortiWins

    CortiWins

    Joined:
    Sep 24, 2018
    Posts:
    150
    Any best practices ressources i should know about?
     
  3. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,913
    CortiWins likes this.
  4. CortiWins

    CortiWins

    Joined:
    Sep 24, 2018
    Posts:
    150
    Nice, thank you!