【3Dゲームエンジン】Unity質問スレッド29at GAMEDEV
【3Dゲームエンジン】Unity質問スレッド29 - 暇つぶし2ch382:名前は開発中のものです。
17/06/15 23:48:11.83 vA8D14AN.net
IEnumerator coroutine;
void Start ()
{
coroutine = Sample2 (10, 0.5f);
StartCoroutine (Sample1 ());
StartCoroutine (coroutine);
}
void Update ()
{
if (Input.GetKeyDown (KeyCode.Space)) {
StopCoroutine (Sample1 ());
}
if (Input.GetKey (KeyCode.Alpha1)) {
StopCoroutine (coroutine);
}
}
IEnumerator Sample1 ()
{
for (int i = 0; i < 100; i++) {
Debug.Log ("Sample1:" + i);
yield return new WaitForSeconds (0.5f);
}
}
IEnumerator Sample2 (int num, float interval)
{
for (int i = 0; i < num; i++) {
Debug.Log ("Sample2:" + i);
yield return new WaitForSeconds (interval);
}
}
サイトに載ってあったのをちょっといじったんですが、Sample1()がスペースを押しても止まりません。
どなたか回答宜しくお願いいたします。


次ページ
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch