[過去ログ] 【3Dゲームエンジン】Unity質問スレッド29 [無断転載禁止]©2ch.net (1002レス)
上下前次1-新
このスレッドは過去ログ倉庫に格納されています。
次スレ検索 歴削→次スレ 栞削→次スレ 過去ログメニュー
372(1): 2017/06/15(木)23:48 ID:vA8D14AN(1) AAS
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()がスペースを押しても止まりません。
どなたか回答宜しくお願いいたします。
上下前次1-新書関写板覧索設栞歴
あと 630 レスあります
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ
ぬこの手 ぬこTOP 0.030s