ユーザ用ツール

サイト用ツール

wiki:unity:tips:115

差分

この文書の現在のバージョンと選択したバージョンの差分を表示します。

この比較画面にリンクする

wiki:unity:tips:115 [2016/09/21 14:53]
step 作成
wiki:unity:tips:115 [2020/03/27 04:22] (現在)
step
ライン 1: ライン 1:
-====== 115 StartCoroutineを使わずコルーチンを回す ====== +[[https://kazupon.org/unity-nonuse-startcoroutine-run-coroutine|該当記事は移動しました!]]
- +
-<code csharp>​ +
-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; +
-            } +
-        }         +
-    } +
-+
-</code> +
- +
-MoveNext を呼ばなければ一時停止扱いにでも出来る。独自のカスタマイズが可能となる。+
Permalink wiki/unity/tips/115.txt · 最終更新: 2020/03/27 04:22 by step

oeffentlich