IEnumerator Animate() { while (pos != "") { yield return(new WaitUntil(() => storyManager.GetPosition() != pos)); pos = storyManager.GetPosition(); // Debug.Log(pos); yield return(new WaitUntil(() => !textManager.IsAnimating())); // Debug.Log("animate for " + pos); if (animations.ContainsKey(pos)) { isAnimating = true; animations[pos](); } } Debug.Log("end of story"); }