Skip to content

Instantly share code, notes, and snippets.

@neruca
Created January 11, 2016 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neruca/d41f3444a82446792da0 to your computer and use it in GitHub Desktop.
Save neruca/d41f3444a82446792da0 to your computer and use it in GitHub Desktop.
Unity Coroutine Example3
using UnityEngine;
using System.Collections;
public class CoroutineTest : MonoBehaviour {
IEnumerator Start () {
Debug.Log ("CountStart !!");
Coroutine coroutine1To5 = StartCoroutine (CountFrame1To5 ());
Coroutine coroutine301To308 = StartCoroutine (CountFrame301To308 ());
yield return coroutine1To5;
yield return coroutine301To308;
StartCoroutine (CountFrame201To205 ());
Debug.Log ("CountEnd !!");
}
// CountFrame1To5() および CountFrame201To205()は
// 変わらないので省略
IEnumerator CountFrame301To308 () {
int i = 300;
Debug.Log ((++i).ToString ());
yield return null;
Debug.Log ((++i).ToString ());
yield return null;
Debug.Log ((++i).ToString ());
yield return null;
Debug.Log ((++i).ToString ());
yield return null;
Debug.Log ((++i).ToString ());
yield return null;
Debug.Log ((++i).ToString ());
yield return null;
Debug.Log ((++i).ToString ());
yield return null;
Debug.Log ((++i).ToString ());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment