「Unity/Csharp/Coroutine」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「==コールチンとは== 条件になるまで待機するもの ==数秒後まで待機== <pre> using System.Collections; private void Start() { StartCoroutine(Delay...」) |
(相違点なし)
|
2022年1月5日 (水) 11:07時点における版
コールチンとは
条件になるまで待機するもの
数秒後まで待機
using System.Collections; private void Start() { StartCoroutine(DelayMethod1(5.0f, 123)); } IEnumerator DelayMethod1(float delay, int hoge) { yield return new WaitForSeconds(delay); // ここに処理を追加 }
unity/Csharp/Invoke [ショートカット]
入力待機
using System.Collections; private void Start() { StartCoroutine(WaitInput()); } IEnumerator WaitInput () { yield return new WaitUntil(() => Input.GetKeyDown(KeyCode.LeftArrow)); }