Unity3d场景加载进度条

来源:互联网 发布:plc步进电机编程实例 编辑:程序博客网 时间:2024/04/19 17:30
int displayProgress;    private IEnumerator StartLoading(int scene)    {        b_showProgress = true;        displayProgress = 0;        int toProgress = 0;        AsyncOperation op = Application.LoadLevelAsync(scene);        op.allowSceneActivation = false;        while (op.progress < 0.9f)        {            toProgress = (int)op.progress * 100;            while (displayProgress < toProgress)            {                ++displayProgress;                yield return new WaitForEndOfFrame();            }        }        toProgress = 100;        while (displayProgress < toProgress)        {            ++displayProgress;            yield return new WaitForEndOfFrame();        }        op.allowSceneActivation = true;        b_showProgress = false;    }



转自: http://blog.csdn.net/huang9012/article/details/38659011
0 0