Why yield wait for seconds not working at all?

I’d like to change the head rotation and neck position at 5 second intervals in the OnAnimatorIK.

I used coroutine, but it doesn’t seem to work.

Debug.Log ("Started Coroutine at timestamp:" + Time.time);

only runs, and then the code doesn’t work.

This is my code:

public void OnAnimatorIK()
{
    var isPlayBtnClicked = GameObject.Find("UI").GetComponent<ApplyToCharacterUIController>().isPlayBtnClicked;

    if(isPlayBtnClicked)
    {
        if(Animator)
        {   
            if(rotList != null)
            {
                for(int i = 0; i < rotList.Count; i++)
                {
                    StartCoroutine(SetHeadRotation(Animator, rotList[i]));
                }
            }
            if(posList != null)
            {
                for(int i = 0; i < posList.Count; i++)
                {
                    StartCoroutine(SetNeckPosition(neck, posList[i]));
                }
            }
        }
    }

    isPlayBtnClicked = false;
    StopAllCoroutines();
}

IEnumerator SetHeadRotation(Animator animator, Quaternion rotation)
{
    Debug.Log("Started Coroutine at timestamp : " + Time.time);
    yield return new WaitForSeconds(5f);
    animator.SetBoneLocalRotation(HumanBodyBones.Head, rotation);
    Debug.Log("Finished Coroutine at timestamp : " + Time.time);
}

IEnumerator SetNeckPosition(Transform neck, Vector3 position)
{
    Debug.Log("Started Coroutine at timestamp : " + Time.time);
    yield return new WaitForSeconds(5f);
    neck.localPosition = Vector3.Lerp(neck.localPosition, position, 0.001f);
    Debug.Log("Finished Coroutine at timestamp : " + Time.time);
}

Well, it’s not surprising, since you call StopAllCoroutines() right after you started them.