I have a script that returns characters to an idle state by triggering a function on a delay time based on
animator.GetCurrentAnimatorStateInfo(0).length.
However, on animation states that have animation events in their timeline, using this method’s info seems to completely disregard any animation events beyond the first one in the timeline.
Stranger still, simply logging or assigning the GetCurrentAnimatorStateInfo to a variable does not do this, only if the data, .length in this case, is used as a function parameter.
I’ve tried both these methods with the same result:
Invoke(nameof(Idle), animator.GetCurrentAnimatorStateInfo(0).length);
and inside a coroutine:
return new WaitForSeconds(animator.GetCurrentAnimatorStateInfo(0).length);
They both stop any further animation events from being called. Is this expected functionality? Is this a bug?
How to get around it? For now the only solution I see for my use case is to put animation events at the final frame for each animation that needs it. But this is a tedious workaround.