Unity3D LoadingScene
来源:互联网 发布:java mvc框架下载 编辑:程序博客网 时间:2024/05/29 19:50
Unity3D LoadingScene
大家都知道,在我们玩游戏的时候,在进入游戏的时候,都会看到会有一个进度条画面,这样做是因为场景加载的需要一定时间,尤其是场景资源很大的时候,都是通过引入一个过渡画面,显示游戏加载进度,这样提高了游戏的体验度。
using UnityEngine;
using System.Collections;
public class LoadingScene : MonoBehaviour
{
public UISlider processBar;//进度条
private AsyncOperation async;
private uint _nowprocess;
// Use this for initialization
void Start()
{
_nowprocess = 0;
StartCoroutine(loadScene());
}
IEnumerator loadScene()
{
//异步读取场景。
async = Application.LoadLevelAsync("Scenename");
async.allowSceneActivation = false;
//读取完毕后返回,系统会自动进入目标场景
yield return async;
}
void Update()
{
if (async == null)
{
return;
}
uint toProcess;
Debug.Log(async.progress * 100);
if (async.progress < 0.9f)
{
toProcess = (uint)(async.progress * 100);
}
else
{
toProcess = 100;
}
if (_nowprocess < toProcess)
{
_nowprocess++;
}
processBar.value = _nowprocess / 100f;
if (_nowprocess == 100)
{
async.allowSceneActivation = true;
}
}
}
- Unity3D LoadingScene
- coco2d-x分析之LoadingScene
- cocos2dx3.3开发FlappyBird总结八:载入场景LoadingScene
- cocos2dx 3d开源项目 fantasyWarrior3D 从零走起 1 [LoadingScene & MainMenuScene]
- Cocos2d-x开发FlappyBird02-LoadingScene启动场景和文件预加载
- Unity3D
- Unity3D
- Unity3D
- Unity3D
- unity3d
- Unity3D
- Unity3D
- Unity3D
- UNITY3D
- Unity3D
- unity3d
- unity3D
- Unity3D
- Microsoft Dom xml写入与读取操作笔记
- mysql select查询的5个子句
- C 知识点
- knitr包 R语言
- 判别模型 和 生成模型
- Unity3D LoadingScene
- 前端编程提高之旅(十四)----jquery DOM操作
- IOS中解决ARC类实例间循环引用(Swfit)
- UIkit 类图
- Unity3D 动态加载外部MovieTexture视频
- SMACK简介
- 在ListCtrl中插入图标(II)
- Xcode6 模拟器不显示键盘解决方案
- 关于XMPP MUC的一些感悟