- Home /
Animator - what does "Can transition to self" do?
Could anyone please fill me in on what does the "Can transition to self" checkbox in animator state transitions actually do?
Because my situation is like this: I have an animator with a few states, each of them has a short animation. The thing is, when the checkbox for self-transition is checked, the animation does not play (stays frozen in the first frame):
But when I uncheck it, it plays correctly:
The weird thing is, that I have a different animator in the project, with pretty much the same setup (just different number of states and different animations associated with the states), and when I attach this animator to an animator controller, the animations play without a problem, even with the self-transition checkbox checked.
Could anyone enlighten me as to the purpose of this checkbox and why I am getting these inconsistent results?
Thanks.
Answer by Pawel_Legowski · Aug 24, 2019 at 08:44 AM
@mahana21 If you do not disable transiting to self. On each update the condition for going from AnyState to your current state will be met, and the animation is rewinded over and over again so you can only see the first frame. You would avoid that by unchecking "Can Transition To Self" or changing you comparing values logic to Triggers (because trigger is cleared after getting conusmed, so the conditions for entering state are met only once and the animation can actually stay in that state instead of entering it over and over again).
Unfortunately I found your answer after I disabled transition to self. I had a problem with my animation clip, it was like a sword animation and when I clicked left mouse button multiple times, the animation repeated before it ended, the animation turned like a dance, I spent hours tried to fix it and I did by luck^_^.
how can I do this in code? because, I hard code my animations. :(