Search Unity

How to make a button effect clicked?

Discussion in 'UGUI & TextMesh Pro' started by IcaroDLima, Jan 3, 2020.

  1. IcaroDLima

    IcaroDLima

    Joined:
    Aug 6, 2019
    Posts:
    25
    I have these two sprites, how can I swap so that the text inside the button follows the movement?
    blue_button00.png blue_button01.png

    I got something similar to what I wanted using Mask and Animator, however, I was looking for a more idiomatic way to do it.

    Problems I encountered while using Mask:
    - Does not take alpha into consideration, causing the button to be jagged at the edges.
    before.png after.png

    Problems I encountered using Animator:
    - If the button comes for example from a MessageBox, and I disable and then enable again, the animation state is inaccurate.

    I think if I knew the name of this type of button everything would be solved with a Google search.