Search Unity

Animator transitions for toggle ui acts like a button animator

Discussion in 'Unity UI (uGUI) & TextMesh Pro' started by CompediaDev, Aug 9, 2018.

  1. CompediaDev

    CompediaDev

    Joined:
    Nov 18, 2014
    Posts:
    3
    The animation transitions for a toggle ui transition like a button.
    Is there a way to get them to transition like they should for a toggle?

    I tried a costume animator and the animator unity provides, and both transition like a button animator would, although it is on a toggle ui.

    The animator transitions seem to be called in a wrong order by the toggle.

    Elaboration:
    • The animator would enter highlight state after the click which then returns to normal state, where as the toggle should remain on the pressed state.

    • I tried overriding the toggle onMouseOver, OnMouseExit but couldn;t get it to work, the animator would still moves from pressed state to normal although the toggle is on.
      It doesn;t matter if I send: isOn = true or invoke onvaluechanged(true).
      The animator simply will not remember the toggle is on.

    • When I disable the toggle gameobject (for instance, the panel is switched off to show another panel), and then enable it: the animator would start at the normal state.

    • When I click the toggle (short click then let go of the mouse), then move the cursor from the toggle - it would return to its normal state and show animation off instead of staying on (like a button would highlight and then return to normal after it was clicked)

    Any suggestions appreciated.