I’m trying to wait for animation to be completed before doing the next action. I’ve tried a few things that haven’t worked.
private IEnumerator WaitForComplete()
while (_anim.GetCurrentAnimatorStateInfo(0).IsName("SwordStart") && _anim.GetCurrentAnimatorStateInfo(0).normalizedTime < 1.0f)
yield return null;
Try using animation events. Put an animation event at the end of the animation that calls a function on the script. In there you can do whatever you want to do after the animation is finished.
I made a small package which you can use to wait for animations to start or finish inside coroutines. You can check it out here: GitHub - ComradeVanti/UnityWaitForAnim: A custom yield-instruction for Unity to wait for animations to finish