- Home /
Animator Stop and Start
I am using an Animator with an empty "NoState" and an animated state "TakeOff". TakeOff is the name of the state as well as the Motion clip name. I have set up a transition between them back and forth bases on a bool, but it's not important right now. The animator could just have one state I guess. What I can't get to work is calling Stop() on the Animator and at another point in time get Play() to play whatever I want to play.
It does not matter how I call Play(), the Animator refuses to start playing. I called it with Play("NoState",0), with Play("TakeOff",0), does not matter, it won't start.
I need this because I created a particular dolly shot but want to animate the camera programmatically for the rest of the time until I need the animation again and the Animator overrides the value while running.
Ho do I get the Animator to start playing anything after stop has been called once?
Answer by SlimeEnthusiast · Feb 12, 2017 at 05:50 PM
Please have a look at the documentation for Animator, particularly the SetBool function
https://docs.unity3d.com/ScriptReference/Animator.html
You really shouldn't need to ever stop the animator, even if you are animating the camera programmatically at times. When you want the animation to fire, just set the bool you are using to true and use SetBool on the animator. Other than that, programmatically animate your camera as you see fit.
I can't really try that anymore, but it sounds like a valid solution, thanks :)
Not to be annoying haha but I do think there are times where one might want to manually control the Animator.
Hopefully this isn't too far off topic but like right now, I'm using the underlying Playables API, I want to blend an Animator Controller with 1 to 2 timelines simultaneously in one PlayableGraph. But my issue is that when I place the AnimatorControllerPlayable in my custom graph, its like playing that same Animator twice, so I was trying to see if I could stop the Animator but play it using my own graph so I can more flexibly control it