打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
利用协程优化耗时的处理
using UnityEngine;
using System.Collections;

public class StartTest : MonoBehaviour {

bool isover = true;

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

    if (isover) {
         isover = false;
         StartCoroutine ("StartCoroutineTest");
    }
}

IEnumerator StartCoroutineTest()
{
        for (int i=0; i<=10000; i++) {//这里会每帧执行一次循环
              Debug.Log("i="+i);
              if(i==10000) isover = true;
              yield return null;
        }
}
}

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Oracle 中用一个表的数据更新另一个表的数据
Howto Install Picasa 3.5 in ubuntu
How To: Install ATI Catalyst (fglrx) Drivers | Fedora Linux
oracle Merge 函数
STATE key located in user's profile
289  LeetCode Game of Life
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服