When i upgraded to Unity 5.2.2 my UI animations won’t work the first time i run them. But they do work the second time.
I see a few threads that also appears to have problems with the animator since the last upgrade. But i can’t figure out if this is the same problem that i see.
I have a gif that show the problem:
When i click the menu button, the buttons are animated to come in to the screen from left to right.
And if you click again they go back from right to left.
As you se on the first click the animator runs, but nothing happens.
on the second and third click it works as expected.
this code is what runs when the menu button is clicked.
this.AboutButtonAnimator.enabled = true;
var isHidden = this.AboutButtonAnimator.GetBool("isHidden");
this.AboutButtonAnimator.SetBool("isHidden", !isHidden);
So my question is if this is Unity bug or i have missed something?
I think I am having a similar issue. I have GameObjects that have disabled animators on them and then via scripting I turn them on. What I would expect is that, when the animator turns on, the default animation should start playing.
In the Mechanim inspector window you can see the blue bar moving across the default clip, and that would suggest everything is working and the animation is playing, but it isn’t.
I have noticed that by enabling and disabling the whole GameObject, rather than just the component, what I explain above does work, and this might be a solution for you, but it wont work for me because I have child objects that I want visible before the animator is enabled
Actually I got around my issue by adding a ‘Restart’ trigger to my animatorController, then I enable the animator and immediately trigger ‘Restart’- it does appear to be a Mechanim bug tho… there appear to be lots in 5.2.2
Had same problem did same thing. It is a bug. After you enable animator it will not display first animation. Anyone with the same problem, if you want solution without reinstalling Unity, just make sure after you reenble animator there is a transition to other animation. Create some zero state and have it transition from it.