public GameObject image; //加载界面
public Slider slider; //进度条
public Text text; //加载进度文本
public void LoadNextLeaver()
{<!-- -->
image.SetActive(true);
StartCoroutine(LoadLeaver());
}
IEnumerator LoadLeaver()
{<!-- -->
AsyncOperation operation = SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().buildIndex + 1); //获取当前场景并加一
//operation.allowSceneActivation = false;
while(!operation.isDone) //当场景没有加载完毕
{<!-- -->
slider.value = operation.progress; //进度条与场景加载进度对应
text.text = (operation.progress * 100).ToString()+"%";
yield return null;
}
}