- Home /
How can i check if an animator has finished?
I need to check when the animation has finished in this context but if i use normalized.time i can't tell which animation should check
Edit: basically my character while walking rotates in the desired direction WASD. When he attacks "Fire1 his movement is reset, but he has the ability to rotate towards the direction. I want him to only rotate when his attack on him (it's a single looped punch) resumes. So I need to check when the animation ends
if (movementDirection != Vector3.zero && anim.GetCurrentAnimatorStateInfo(0).IsName("MyAnim"))
Answer by SirCrazyNugget · Jun 26, 2021 at 10:24 AM
Add an Event to the end of the animation https://docs.unity3d.com/Manual/script-AnimationWindowEvent.html
i knew. no way to get it as I asked for it?
because I can't get the result I want.
basically my character while walking rotates in the desired direction WASD. When he attacks "Fire1 his movement is reset, but he has the ability to rotate towards the direction. I want him to only rotate when his attack on him (it's a single looped punch) resumes. So I need to check when the animation ends
Answer by Venividiviciuus · Jun 26, 2021 at 02:41 PM
I SOLVED. with Event animation.
Ias I took an external animation and it was only in READ ONLY. I created another one and copied the keyframes in order to have an "open source" animation
Answer by spilat12 · Jun 26, 2021 at 03:29 PM
Just for the record, if anyone needs it in the future: you can check a given animator state by using runtimeAnimatorStateController, i.e. you can check whether your animator is playing a certain state/animation or not. EDIT: If you have an issue with continous checks or something like that, here's some gold for you: check the OnStateExit API, thank me later :-)
Though it's better to be told rather than continually asking.
Your answer
Follow this Question
Related Questions
2D Animation does not start 1 Answer
Can I make a new Base Layer (in Animator) without defining a default state? 0 Answers
what is the total difference of th animation component and animator component? and can u use both? 1 Answer
Problem with animator any state and transitions 2 Answers
How to start an animation by the exit animation frame 0 Answers