- Home /
Are coroutines freezing my game?
I had a sequence scripted using Coroutines, which ran fine in the editor, but froze the build. Much googling and tweaking ensued. I decided to create a test case: a new project, added a GameObject with a TextMesh (for visual feedback), and a small script:
void Start () {
StartCoroutine (Test ());
}
IEnumerator Test () {
TextMesh textMesh = gameObject.GetComponent<TextMesh> ();
int i = 0;
while (true) {
textMesh.text = i.ToString();
i++;
yield return new WaitForSeconds (0.2f);
}
}
Straightforward test producing the expected results in the editor. However, at build time it would run as far as 9 and freeze. Force Quit was the only option. Development Build works as expected, perfectly. By the way, I'm on OS X 10.10.2, and updated Unity about an hour ago.
Can anyone shed some light on this?
Comment