Coroutine / Switch case

Animator anim;
int inputNum;

public IEnumerator PlayAnims()
{
    switch (inputNum)
    {
        case 1:
            anim.Play("1");
            Debug.Log("1");
            yield return new WaitForSeconds(1);
            break;
        case 2:
            anim.Play("2");
            Debug.Log("2");
            yield return new WaitForSeconds(1);
            break;
        case 3:
            anim.Play("3");
            Debug.Log("3");
            yield return new WaitForSeconds(1);
            break;
    }
}

So the idea is that it should only play one animation at a time for 1 second then play the next one for 1 second etc. If it gets multiple inputs at once it picks the one which was first, like a queue, so if the input is 2,1,2,3 then they play those animations in that order 1 second at a time before the next animation starts.

Ok lemme put it this way. Nothing in your Coroutine allows for anything more than one animation to play. If you try to stick it in a loop and call it for each value, all animations would technically be called at the same time not 1 each second since a loop completes in it’s entirety in 1 single frame and there can be multiple Coroutines running at the same time. That said if the loop were inside the Coroutine that would be a different story. Such as:

public IEnumerator PlayAnims(string inputString)
{
    char[] inputs = inputString.ToCharArray();

    foreach (char inputNum in inputs)
    {
        switch (int.Parse(inputNum.ToString()))
        {
            case 1:
                anim.Play("1");
                Debug.Log("1");
                yield return new WaitForSeconds(1);
                break;
            case 2:
                anim.Play("2");
                Debug.Log("2");
                yield return new WaitForSeconds(1);
                break;
            case 3:
                anim.Play("3");
                Debug.Log("3");
                yield return new WaitForSeconds(1);
                break;
        }
    }
}