Unity3d---> IEnumerator

来源:互联网 发布:防范网络诈骗心得800 编辑:程序博客网 时间:2024/06/05 20:17
using UnityEngine;using System.Collections;public class Test : MonoBehaviour {IEnumerator Start () {yield return StartCoroutine(login());Debug.Log("CCCCCCCCCCCCC");Destroy(this.gameObject);}IEnumerator login () {Debug.Log("AAAAAAAAAAAAAAAAA");yield return new WaitForSeconds(0);Debug.Log("BBBBBBBBBBBBBBBBB");}}

------print--------

AAAAAAAAAAA

BBBBBBBBBBB

CCCCCCCCCCC

--------------------

using UnityEngine;using System.Collections;public class Test : MonoBehaviour {void Start () {StartCoroutine(login());Debug.Log("CCCCCCCCCCCCC");Destroy(this.gameObject);}IEnumerator login () {Debug.Log("AAAAAAAAAAAAAAAAA");yield return new WaitForSeconds(0);Debug.Log("BBBBBBBBBBBBBBBBB");}}


------print--------

AAAAAAAAAAA

CCCCCCCCCCC