I’m making a progress bar in unity for loading scenes but the bar goes from 0 to 100 without stopping in the middle
public void Loading(string sceneID)
{
screen.SetActive(true);
StartCoroutine(LoadingAsync(sceneID));
}
public IEnumerator LoadingAsync(string sceneID)
{
yield return null;
AsyncOperation operation = SceneManager.LoadSceneAsync(sceneID);
operation.allowSceneActivation = false;
while (!operation.isDone)
{
float progress = Mathf.Clamp01(operation.progress / .9f);
Debug.Log(progress * 100 + "%");
loadingBar.value = progress * 100f;
loadingPer.text = progress * 100f + "%";
if (operation.progress >= .9f) { operation.allowSceneActivation = true; }
yield return null;
}
}
Here is the debug
Expected the loading bar progress to be smooth but it just goes from 0 to 100