IEnumerator<string> LoadScene(string name, Slider slider, TextMeshProUGUI text) {
yield return null;
AsyncOperation operation = Loader.Loader.LoadSceneAsync(name);
operation.completed += asyncOperation => Debug.Log("Load scene completed!");
operation.allowSceneActivation = false;
float progress = 0;
while (!operation.isDone) {
progress = Mathf.MoveTowards(progress, operation.progress, Time.deltaTime);
slider.value = progress;
text.text = string.Concat("加载中...", operation.progress * 100, "%");
if (progress >= 0.9f) {
slider.value = 1;
operation.allowSceneActivation = true;
}
yield return null;
}
}
![]()