您的位置:首页 > 移动开发 > Unity3D

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;
}
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: