- Home /
how to stop animator?
Hi to all.
I've a character animated using mecanim animator. When the character have to fall I use a ragdoll, and I need to deactivate immediatly the animator. To do so, I'm enabling/disabling the animator component, but this procedure is too slow. Is it possible to stop the animator like the single animations (using something similar to animation.Stop()) ??
Answer by Rober_Burn · Jun 17, 2014 at 11:01 AM
i use this: http://docs.unity3d.com/ScriptReference/Animator-speed.html
0 is stoped, 1 normal, 2 fast, 3 more fast, 4 ultra fast, 100000000 extra^(10e9999) fast
i hope that you understand the api of unity, good look
Answer by Luis Araujo · Jun 23, 2014 at 05:53 AM
Simple!
private Animator a;
a.enable = false; ,Simple!
private Animator a;
a.enable = false;
it's not work when ever you re-enable animation, it's first complete last un complete anumation.... any other option to start animation from idel mode..?
Answer by iThink · Feb 27, 2013 at 01:39 PM
Have You tried .active = false; and it will respond fast and the animator will stop
I suppose active has the same response time than enabled... isn't it?
Answer by guykogus · Nov 22, 2013 at 11:56 AM
Destroy(GetComponent<Animator>());
Or maybe even use DestroyImmediate
if that's too slow.
Never use DestroyImmediate at runtime. It's ment to be used in editor scripts. You won't see any difference anyway. Destroy is just delayed until the end of the current frame. So at the next screen update it doesn't exist anymore.
I was just playing with it and discovered that myself. Thanks :)
Your answer
Follow this Question
Related Questions
Using Ragdoll on character with mecanim animator 2 Answers
Mecanim and Ragdoll Issues? 2 Answers
Switching Animator on/off 0 Answers
Blending Animator Animations with Ragdoll 2 Answers
Animator overriding collisions? 0 Answers