void Update() { if (thread != null && !thread.IsDead()) { thread.Resume(); } }
// Update is called once per frame void Update() { if (!co.IsDead()) { co.Resume(); } else { print("Coroutine has exited."); // In order to destroy a coroutine (but not the function in lua, just the coroutine stack instance) simply allow C# to clean up the wrapped object co = null; } }