Hello.
I’m having trouble to make a smooth transition between scene with a loadbar.
I’m using AsyncOperation like how it’s explained in Unity’s doc here, this looks pretty easy but it doesn’t work well. My progress bar isn’t smooth at all (I guess there are 2/3 frames where I can see update of the loading bar). Also all the debug of the AsyncOperation’s progress occurs on the same frame. It looks like Unity is overloading therefore it causes little freezes. There is my code
AsyncOperation asyncOperation = SceneManager.LoadSceneAsync(scene);
asyncOperation.allowSceneActivation = false;
while (!asyncOperation.isDone)
{
print(asyncOperation.progress);
loadBar.value = asyncOperation.progress;
if (asyncOperation.progress >= 0.9f)
{
if (Input.GetKeyDown(KeyCode.Space))
asyncOperation.allowSceneActivation = true;
}
yield return null;
}