- Home /
Question by
PijusVose · Jun 01, 2018 at 04:39 PM ·
animationwaitforseconds
Animator not working properly
I have an IEnumerator, which waits till animation has stopped playing, but sometimes the WaitUntil returns true instantly. Here is my code:
Animator previewAnimator = currentPreview.GetComponent<Animator>();
previewAnimator.SetTrigger("Place");
yield return new WaitWhile(() => previewAnimator.GetCurrentAnimatorStateInfo(0).normalizedTime >= 1f);
Sometimes the WaitWhile finishes after animation end, sometimes the WaiWhile finishes instantly. Could it be that the transition is between a looping and non-looping animation?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612163858im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
No input from keys for specific amount of seconds? 1 Answer
Can I make animations snap to a frame? 1 Answer
script runs fine on start up, but slows on second attempt 1 Answer
WaitForSeconds twice in 1 if statement, not working 2 Answers
How to implement a "wait" after an animation has finished? 2 Answers