- Home /
Question by
RKSandswept · Apr 03, 2015 at 10:33 PM ·
yield
Yield in loop never returns. [Solved]
We ran into the problem where Coroutines with for or while loops with
yield return new WaitForSeconds(0.1f);
style never return. After extensive puzzling we figured out it was because the coroutines were in an EditorWindow extension we wrote. Because the game is not 'ticking' both
WaitForSeconds
and the
yield return null
never get ticks to work with so they hang.
Our solution is to have the 'normal' methods that are not coroutines and the same method with Async in the name. Like...
SetupIMU()
SetupIMUAsync()
The Async version uses yield and has a IEnumerator return type. The other has a void return type.
Can we get any verification that this correct?
Comment