【3Dゲームエンジン】 ..
[2ch|▼Menu]
37:名前は開発中のものです。
18/02/12 13:21:24.96 2m1iD4au.net
コルーチンの停止について質問させてください。
以下のコードのようにクリックしたらtestCoroutineを止めるというのをやりたいのですが、
testCoroutineだけでなくStart()の中のコルーチンもなぜか止まってしまいます。
(実際にコンソールに"startCoroutine"が表示されない)
testCoroutineのみを止めるにはどうすればよいでしょうか?
public class CoroutineTest : MonoBehaviour {
IEnumerator testCoroutine;
IEnumerator Start() {
while (true){
testCoroutine = TestCoroutine();
yield return StartCoroutine(testCoroutine);
Debug.Log("startCoroutine");
yield return null;
}
}
void Update () {if(クリックしたら) StopCoroutine(testCoroutine);}
IEnumerator TestCoroutine(){
while (true){
Debug.Log("testCoroutine");
yield return null;
}
}
}


次ページ
続きを表示
1を表示
最新レス表示
スレッドの検索
類似スレ一覧
話題のニュース
おまかせリスト
▼オプションを表示
暇つぶし2ch

19日前に更新/280 KB
担当:undef