Skip to content

Instantly share code, notes, and snippets.

@neruca neruca/blog20150111-3 Secret
Created Jan 11, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.