Unity3D LoadingScene
2014-11-22 11:43
239 查看
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使用loading场景的主因
- Unity3d打开的时候,卡在loading界面白屏的解决方法
- Unity3D说明文档翻译-Scene View Control Bar
- unity3d中的物体,在Scene窗口中可以看到,而在Game窗口中看不到的原因
- Unity3d中制作异步Loading进度条
- unity3d实现Loading进度条异步加载场景
- Unity3D自学笔记——架构应用(五)Loading场景及持久化场景
- Unity3D 扩展 Scene
- coco2d-x分析之LoadingScene
- Unity3d中制作Loading场景进度条所遇到的问题
- error while loading shared libraries:libmoveit_planning_scene_monitor.so.0.9.10
- cocos-2dx 随记- 打飞机(LoadingScene.lua) - 第4天
- Unity3d中制作异步Loading进度条所遇到的问题
- Unity3d中制作Loading场景进度条(转)
- Unity3D——异步加载游戏场景loading界面的开发
- Unity3d制作Loading场景进度条
- 【Unity3d】如何解决错误:A script behaviour has a different serialization layout when loading
- unity3d实现相机对场景物体的旋转、缩放、平移查看功能、近似于scene下查看场景的效果
- Unity3D之在Scene窗口显示Waypoint路径
- [unity3d]自定义loading界面和浏览器的全屏显示