-
-
Save neruca/d41f3444a82446792da0 to your computer and use it in GitHub Desktop.
Unity Coroutine Example3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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