- Home /
Why loading slider is not gradual when async loading scene?
Hello all,
I have an issue with async scene loading. I want the next scene to load asynchronously and while loading the slider will indicate the loading progress, based on this code:
IEnumerator LoadAsynchronously(int currentSceneNumber)
{
loadingSceneSphere.SetActive(true);
yield return new WaitForSeconds(1.5f);
AsyncOperation operation = SceneManager.LoadSceneAsync(currentSceneNumber);
float loadingStartTime = Time.time;
operation.allowSceneActivation = false;
while (!operation.isDone)
{
print("OP");
float progress = Mathf.Clamp01(operation.progress / .9f);
loadingBar.value = progress;
progressText.text = Mathf.Round(progress * 100) + "%";
if (operation.progress >= 0.9f)
{
loadingSceneSphere.SetActive(false);
operation.allowSceneActivation = true;
}
yield return null;
}
}
The actual result is the current scene will freeze, then the loading bar would be full the text will show 100% and next scene will load. I want the loading slider to be gradually filled and the text to run from 0% -100% evenly. Tested in the build and it is the same abrupt fill of the slider, the text jumps to 0 - 27 - 100%.
Is this possible in Unity?
Thank you
Your answer
Follow this Question
Related Questions
Object creating progress 0 Answers
Need some help with controlling audio with ui slider . 0 Answers
How to Make a Vertical-Scroll Number Input Field, i.e. < > Value Amount 0 Answers
Slider with max value in the middle 0 Answers
bolt errors 1 Answer