- Home /
Animation States and Transitions not Respected
When I tell the gameobject to Play("Her3_slide") it plays the animation, then it plays Her3_slideBack immediately afterwards even though I have no transition set up to do that. I want it to move over, then wait for a later scripted command to slide back, as I have other animations that need to play in between those two.
If I tell it to Play("Her3_slideBack") then it works as one would expect: it snaps to the start position of that animation, then moves over, and stops.
And yes, Her3_slide does not contain any reset animation in it. I checked. Twice.
What gives?
Answer by Dblfstr · Mar 17, 2014 at 07:15 PM
Could be a couple of different things. It looks like you have transitions from Her3_slide to Idle, and from her3_slideback to idle. I imagine these have some parameter to control the transition. So if call the animation directly to play he3_slide, when it is over, it will look for a default transition back to idle, and the parameter for the transition from slideback to idle, just might be the best solution.
I would say, you need a transition TO and FROM the her3_slide and idle. Then, when you want to play the her3_slide, you do not call it directly, but you use its parameter to initiate the animation. Could be as simple as a bool or trigger.
The parameter could be a trigger named doSlide;
in youy script, you would SetTrigger("doSlide", true); to initiate the slide, when it is done, it will transition back to idle (given that the transition for slideback is not met).
Yeah, I got it worked out a little while ago. I guess I didn't understand how the state machine was supposed to work.
But yeah, had to make the arrows go the other way and use conditional triggers.
Your answer
![](https://koobas.hobune.stream/wayback/20220613140457im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Duplicate Animator Controller problem - models still using the previous controller 1 Answer
Animator Override Controller changed at runtime doesn't always play the animations correctly 1 Answer
Animations on Instantiated Prefabs not working 0 Answers
Animator has not been initialized!!!!!! Help!! 2 Answers
UFPS - Player Animation Setup 0 Answers