以前のリビジョンの文書です
using UnityEngine; using System.Collections; public class TestCoroutine : MonoBehaviour { private IEnumerator m_Enumerator; void Start () { m_Enumerator = CustomProcess(); } IEnumerator CustomProcess() { Debug.Log("wait"); yield return null; Debug.Log("Complete!!!"); yield break; } void Update () { if( m_Enumerator != null ) { // 次のフレームへ進めている。 bool result = m_Enumerator.MoveNext(); if (result) { Debug.Log("Next."); } else { // コルーチン終了。 Debug.Log("End."); m_Enumerator = null; } } } }
MoveNext を呼ばなければ一時停止扱いにでも出来る。独自のカスタマイズが可能となる。