Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Loading progress going from 0 to 100 automatically without full load of scene

$
0
0

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


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>