- Home /
Animation state not transitioning at 100%
Hi everyone,
I have recently run into a very annoying problem with Unity's mecanim system I cannot seem to figure out on my own.
I have an animator setup with a bunch of states. Some of the states have no transition conditions and are instead set to have an exit time of above 1 (e.g. 5). 95% of the time this works beautifully. The state loops multiple times, then transitions to the next state. The remaining 5% of the time, the state simply gets stuck at 100% (a normalized time of 1) and does not transition although the only transition it has does not have any conditions.
Did anyone else run into this issue and if so, is there a way to fix it? I don't really see a way to neither detect if the state got stuck nor trigger the transition manually since it has no conditions I can force. Any help is very much appreciated!
Sincerely, Valtaroth
EDIT: As requested I have attached screenshots of the animator as it is stuck and the state's only transition:
This particular transition leads to a blendtree but I have other states which transition to simple states and get stuck the same way. The similarities are the exit time above 1 and a single transition with no condition. I have never seen it happen with exit times equal to or below 1, but I require higher exit times in certain cases.
Hopefully this helps to shine more light on the issue.
Because I just realized this might be the next question: no, it is not continuously transitioning into the state from AnyState, it only does so once. There are my parameters tied to the transition from AnyState which are only triggered once, afterwards the state simply remains like shown above.
Answer by FortisVenaliter · May 20, 2016 at 02:13 PM
Look at the graph there in the bottom of your second screenshot. I believe the issue is that the old clip ends far before the new clip begins. What is it supposed to do in that gap with no animation? You need to move the animations so they meet or overlap. Or set one of them to looped, so it will be continuous, and have a point of reference for the transition.
Exit time of 8 means 'do this after the animation has played 8 times'. But if it's not looping, it will get stuck after running the first.
The animation is actually set to loop and 9 out of 10 times it will work like you described, but what you see here is the 10th time when it just does not want to behave that way. Do you know of any reason why that could be the case?
If it was set to loop, it would represent that in the graph. That animation graph shows that it is not going to loop.
I'm sorry, you are right. I re-checked the clip's settings and it is indeed not set to loop. But if that was the issue's cause why would it be working most of the time? Shouldn't if fail every time then?
Your answer
Follow this Question
Related Questions
Character animation position 1 Answer
How to Change the Motion of an Animation State in an Animator Controller at Run-Time? 1 Answer
Unity 5 - Model invisible with Mecanim in Edit mode? 1 Answer
Why does this animator appear to occupy two states, but report only one? 0 Answers
Accessing AnimationState in Animator 0 Answers