private void Start()
{
LoadAScene();
}

public void LoadAScene()
{
StartCoroutine(LoadSceneAsync("SceneLogin"));
}

IEnumerator LoadSceneAsync(string sceneName)
{
AsyncOperation operation = SceneManager.LoadSceneAsync(sceneName);
operation.allowSceneActivation = false;
while (!operation.isDone)
{
#if UNITY_EDITOR
Debug.Log("Progress is :" + operation.progress);
#endif
float progress = Mathf.Clamp01(operation.progress / 0.9f);
progressBar.fillAmount = progress;
loadText.text = ((int)progress * 100).ToString() + "%";
yield return null;
if (progressBar.fillAmount >= 0.85)
{
Debug.Log("跳出协程");
yield break;
}
}
operation.allowSceneActivation = true;
}