I am loading scenes async using addressables like so
AsyncOperationHandle<SceneInstance> asyncOperation = Addressables.LoadSceneAsync(sceneReference, LoadSceneMode.Additive);
while (!asyncOperation.IsDone)
{
if (asyncOperation.PercentComplete < 0.9f)
{
Debug.Log($"\t{sceneReference.Name} Loading progress: {asyncOperation.PercentComplete * 100}% frame:{Time.frameCount}");
}
else
{
Debug.Log($"\t{sceneReference.Name} Loading complete but still in loop?: {asyncOperation.PercentComplete * 100}% frame:{Time.frameCount}");
}
yield return null;
}
It reaches 90% on the first frame, which, based on my reading should mean it's finished loading.
However, the console spits this out:
So it's not actually finishing the load until 3 frames later.
I'm at a loss to figure this out. Shouldn't it exit without a single iteration through the while loop? My game shows a very brief flash when swapping between screens, as I've already unloaded the previous scene and there is this 3 frame gap before the new scene appears.
Any help would be much appreciated.
allowSceneActivation
to stop the new scene from rendering until the load has completed and you've unloaded the previous scene, to avoid having two running simultaneously, while still not allowing a gap in between? \$\endgroup\$