標籤:void component isl gem rtl return enum load UI
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 資源進度讀取