unity3d 资源进度读取
Posted 游戏鼻祖
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了unity3d 资源进度读取相关的知识,希望对你有一定的参考价值。
using UnityEngine; using System.Collections; using UnityEngine.SceneManagement; public class _03starLoad : MonoBehaviour { public GameObject LoadingBar; public string str; // Use this for initialization void Start () { if (str != "") { StartCoroutine(StartLoading(str)); } } //小场景载入 IEnumerator StartLoading(string str) { float i=0; AsyncOperation acOp = SceneManager.LoadSceneAsync(str); acOp.allowSceneActivation = false; while(i<=100) { i++; LoadingBar.GetComponent<UISlider>().value = i/100; yield return new WaitForEndOfFrame(); } acOp.allowSceneActivation = true; } /*大场景载入 IEnumerator StartLoading(string str) { AsyncOperation acOp = SceneManager.LoadSceneAsync(str); acOp.allowSceneActivation = false; LoadingBar.GetComponent<UISlider>().value =acOp.progress; yield return acOp; } */ }
以上是关于unity3d 资源进度读取的主要内容,如果未能解决你的问题,请参考以下文章
Unity3d中制作Loading场景进度条所遇到的问题 LoadLevelAsync,AsyncOperation