言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

MonoBehaviour.StopCoroutine

Switch to Manual
public function StopCoroutine(routine: IEnumerator): void;

Description

このBehaviour上で実行されている methodName という名のコルーチンを全て停止します

文字列のメソッド名を使った StartCoroutine のみStopCoroutineを使用して止められることに 注意してください。

	// In this example we show how to invoke a coroutine using a string name and stop it

	function Start () {
		StartCoroutine("DoSomething", 2.0);
		yield WaitForSeconds(1);
		StopCoroutine("DoSomething");
	}

	function DoSomething (someParameter : float) {
		while (true) {
			print("DoSomething Loop");
			// Yield execution of this coroutine and return to the main loop until next frame
			yield;
		}
	}