您的位置:首页 > 移动开发 > Unity3D

unity里的什么函数可以成为携程。

2014-07-17 12:34 288 查看
一个函数以 IEnumerator 开头,而且里面只要有yield语句就行。

并不需要在经过该携程必须经过一次yield语句,例如:下面这种是正确的:

using UnityEngine;
using System.Collections;

public class twoIEnumerator : MonoBehaviour {

    int i=3;
    // Use this for initialization
    void Start () {
        StartCoroutine ("f");
    }

    IEnumerator f()
    {
        if (i != 3) {
            Debug.LogError("In!");
            yield return null;        
        }
        Debug.LogError ("Can!");
    }
    // Update is called once per frame
    void Update () {
    
    }
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐