`
wanzhanzhuce
  • 浏览: 25768 次
社区版块
存档分类
最新评论

协程执行顺序测试备份

阅读更多

using UnityEngine;
using System.Collections;

public class test1 : MonoBehaviour {

 // Use this for initialization
 void Start () {
        StartCoroutine(testc());
 }

    private IEnumerator testc()
    {
        Debug.Log("test enter");
        //fun();
        StartCoroutine(testc2());
        //yield return StartCoroutine(testc2());
        Debug.Log("test after fun");
        yield return new WaitForSeconds(1);
        Debug.Log("test over");
    }

    private void fun()
    {
        Debug.Log("fun enter");
        StartCoroutine(testc2());
        Debug.Log("fun over");
    }
    private IEnumerator testc2()
 {
        Debug.Log("test2 enter1");
        Debug.Log("test2 enter2");
        Debug.Log("test2 enter3");
        yield return new WaitForSeconds(2);
        Debug.Log("test2 over");
    }

 // Update is called once per frame
 void Update () {
 
 }
}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics