I have recently upgraded to unity 5. I have been making an android game which contains quite a few animations. I created them on unity 4 and they automatically played and looped. Since I have upgraded to unity 5 these animations will not even play in-game. Like it was in unity 4 I need the animation to automatically start and then loop until the scene ends. I have no idea how to do this. Please help!
I’m not sure if your problem is the same as mine was, but you may be doing:
Time.timeScale = 0f;
this will prevent your animation from running if the Animator is set to Normal update mode. To get around this, set it to UnscaledTime in the animator settings or put this line in your code:
<Animator>.updateMode = AnimatorUpdateMode.UnscaledTime;
"I had the same problem with an animation and I found it is related to the ‘Static Batching’ feature present in Unity 5. Here is how I solved it:
-
Select the object you are animating.
-
In the Top-Right corner of the
Inspector window you’ll see a drop
down list near to the Static label,
click on it. -
Uncheck the ‘Batching Static’ option."
Source: game engine - Animation not working Unity 5 - Stack Overflow
Try selecting your animation clip in the Project window then change the Inspector window to Debug by right clicking its tab.
Now you should be able to set Legacy to true.
You can also select Wrap Mode to Loop if you need it.
Go to ANIMATOR component → right click → click on OPTIMIZE TRANSFORM HIERARCHY.
I don’t know how it works but it works!
I encountered animations randomly not working, the fix was to disable then enable the animation. This resets something in the animation system and playing works fine after.
My problem was a renamed bone in the object’s hierarchy. Looks like it stops bone from working for the animation.
a bit old question but this could help others as well, if you are using layers, make sure you have the correct layer mask with relevant skeleton items selected and not conflicted with other layers.
remove the layer mask and try playing the animation to make sure about this issue.
because when I play the animations in Unity 3D when there are several of them it doesn’t work and it doesn’t play anything and it is deleted from the animatior