unity 过度条场景
2016-05-16 17:51
706 查看
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// UGUISceneLoader script.
/// This is used to show the progress of scene loading.
/// </summary>
public class UGUISceneLoader : MonoBehaviour
{
public Slider progressBar;
public Text progressText;
private AsyncOperation _async;
void Start()
{
// Scene Load asynchronously.
_async = Application.LoadLevelAsync(SceneManager.Instance.currentLoadScene);
Debug.Log (SceneManager.Instance.currentLoadScene);
}
void Update()
{
// Scene loading process update.
if (!_async.isDone)
{
float pProgress = _async.progress * 100f;
int pInt = Mathf.RoundToInt(pProgress);
progressText.text = pInt.ToString() + "%";
progressBar.value = _async.progress;
}
}
}
using UnityEngine.UI;
/// <summary>
/// UGUISceneLoader script.
/// This is used to show the progress of scene loading.
/// </summary>
public class UGUISceneLoader : MonoBehaviour
{
public Slider progressBar;
public Text progressText;
private AsyncOperation _async;
void Start()
{
// Scene Load asynchronously.
_async = Application.LoadLevelAsync(SceneManager.Instance.currentLoadScene);
Debug.Log (SceneManager.Instance.currentLoadScene);
}
void Update()
{
// Scene loading process update.
if (!_async.isDone)
{
float pProgress = _async.progress * 100f;
int pInt = Mathf.RoundToInt(pProgress);
progressText.text = pInt.ToString() + "%";
progressBar.value = _async.progress;
}
}
}
相关文章推荐
- unity 单例脚本
- unity 陀螺仪的脚本
- unity 事件的触发脚本
- Unity3d基于第三人称控制简单优化
- Unity引擎下最快的Xml读取器:UnityRapidXml
- Unity3D SubMesh 个人理解
- [unity]在unity中创建圆锥体
- 读《Unity 5.x 游戏开发指南》
- Unity Asset Store资源下载路径 资源保存路径
- Unity 函数图
- DrawCall相关优化(Unity 5.4)
- unity 有限状态机使用
- photon Unity RPC 调用流程
- photon Unity RPC 调用流程
- Unity协程(Coroutine)原理深入剖析
- Unity uGui RawImage 渲染小地图
- Unity3D 基地实现(摄像机移动、拖动建筑等)
- HoloLens开发手记 - Unity之Gestures手势识别
- Unity3D -- ScreenToWorldPoint
- 【Unity3D】 Unity Chan项目分享