- Home /
How to transition right after the animation finishes for the first time.
Hello,
Today's the first time I'm trying to use the Animator controller. I've managed to set up a transition triggered by a "trigger" which I set via script. That works.
I want the second state to play an animation once and then return to the previous state. How do I accomplish this? I'm sure it's easy but I didn't manage to find anything useful in a few minutes of Googling.
Thank you!
Answer by DFT-Games · Oct 30, 2015 at 08:32 PM
Hi @kaka24fan,
Simply create a transition from the animation that has to play once to the final status and have the transition parameters condition free and with the Has Exit Time checked, similar to this:
Hope this helps!
-Pino
i was just looking for that for a shooting animation and going back to idle, thanks alot!
I have a follow-up to this. What about the condition to get into this animation? For example, I have a state integer that, when it is 1, 2, 3, or 4 it changes the animation. However, if I do this, then the animation will loop indefinitely because I am not changing the variable. But, if I change the variable in the Update method, then it does not give the animation enough time to transition. Basically, my question is, is there a way to use an if statement conditioned on "if the animation transitions from animation X to animation Y" so that I can change the state after the animation is complete? Or some easier way than that?
Your answer
Follow this Question
Related Questions
[StateMachineBehaviours] All prefabs share same state machine. 0 Answers
Easier way of creating transitions in the animator? 1 Answer
The Quantum Animator? - Animator behaving differently when animation controller is open in editor 0 Answers
smoothly Animate clips simultaneously 0 Answers
Animator subtracting float to change states in c#? 0 Answers