Button Animation Getting Stuck With SetActive

I have buttons being animated to scale to 1.11 on mouse over and 1.25 on click. It works fine, but when I click the button, I call SetActive on their parent to disable them and bring up a new set of buttons, and when I go back to the original buttons, they are stuck in partial animation rather than being back to scale 1. (For example, when I switch menu modes and back again, and choose one of the stuck buttons in the inspector, the scale is stuck around 1.22 or so, and if I hover, it goes down to 1.11, and if I click, it goes up to 1.25, but if I go back off the button it goes back to the 1.22 it was at before.

To fix this, I went into the Animation window for the “Normal” state, started recording a keyframe, changed the scale and reverted it (so it essentially was a “no op” at 1), and now when the button comes back the animator fixes it.

I’m not sure if this is a bug or not. But I think it should definitely be included in documentation/tutorials for the animator as a “gotcha”.

3 Likes

yeah I have this problem too, anyway to force a reset?

For anyone interested, a solution that worked for me was to make sure every property was set in the initial animation: “Normal”.
e.g. If “Highlighted” animation sets the sprite or changes color, then “Normal” must have those properties set also

1 Like