Hi there, I’m working on my first game and I just started finally adding a little more polish to the UI. I’m making UI animations like windows moving and fading, but I’ve run itno an issue:
I have a window that plays an animation when it closes, but while it’s open, the game is paused, and I want the game to unpause after the animation is done. The issue is I can’t seem to get the exact length of the animation clip that plays when the Animator goes into its close state.
Here is the coroutine that handles this:
public IEnumerator EndDialogueCoroutine()
{
animator.SetBool("IsOpen", false);
yield return new WaitForSeconds(closeSpeed);
uiManager.CloseAndResume();
}
animator is the attached Animator component that has the animation states:
So right now in the code I am setting my own closeSpeed
to a rough estimate, but what I want is to find out the length of the animation that plays when I change the bool to IsOpen = false.
Is there any way to do this ?