Slide 22
Slide 22 text
void Start()
{
// 入れ子のコルーチンを呼び出す
StartCoroutine(ParentRoutine());
}
IEnumerator ParentRoutine()
{
Debug.Log("start parent");
// 子コルーチンの呼び出し
yield return ChildRoutine();
Debug.Log("end parent");
}
IEnumerator ChildRoutine()
{
Debug.Log("start child");
yield return new WaitForSeconds(1.0F);
Debug.Log("end child");
}
実行結果
start parent
start child
end child
end parent
※ Unity 5.3 以降