Integration Test
I encountered a strange behavior while running integration tests for an animator. the following is the sequence of calls.
yield return null; // called in a coroutine at frame 1
animator.Play("t"); // called in LateUpdate at frame 1
yield return null; // entered frame 2
yield return null; // animator state changed after this call during frame 2
// now we're at frame 3
Assert.AreEqual(animator.state == "t"); // correct
When I ran the integration test one by one these works.
But when I ran them all the second tests always fail. It's almost as if the StartCoroutine of the second integration test isn't called during Update but after LateUpdate in the frame so animator.play("t") isn't called at frame 1 but end up in frame 2. The coroutine was started in Start() so technically it should happen during Update of frame 1. There must be something about the way integration tests run in batch that I am not aware of.
To resolve this I simply added "yield return null" at the start of all coroutine.
Comment
Your answer