Addressables.LoadSceneAsync Percent Complete not updating on WebGL?

Context:

I’m working on a WebGL build that consists of a very minimal bootstrap scene that then loads a fairly large initial core game payload that’s contained in a single scene. I’d very much like to be able to monitor the progress of the load so I can present some simple but diverting content in the interim. Very basic stuff, right?

However, when I test this, PercentComplete jumps immediately from 0 to .5 and then continues to hang at .5 until the scene is completely loaded. I’m testing this with a remote server on a veeeeery slow connection and the payload is relatively large, caches are cleared etc, so I would expect to see the progress slowly increment like it would with SceneManager.LoadSceneAsync (etc).

I’m using Unity 2018.3.12.f1 / Addressables package version 1.5.0

Here’s my very simple bootstrap code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.UI;

public class BootstrapController : MonoBehaviour
{

    public string NextSceneAddress;
    public float percentDone = 0;
    [SerializeField] private Text LoadingText;
    AsyncOperationHandle handle;


    // Use this for initialization
    void Start()
    {
        StartCoroutine(Bootstrap());
    }

    IEnumerator Bootstrap()
    {
        yield return null;


        handle = Addressables.LoadSceneAsync(NextSceneAddress);

        int i = 0; //increment; otherwise useless sanity check that the while loop is looping...
        yield return null;

        while (!handle.IsDone)
        {
            percentDone = Mathf.Floor(handle.PercentComplete * 100.0f);
            LoadingText.text = i++ + " Loading " + percentDone.ToString() + "% Done";


            yield return null;
        }
        // else scene should load automatically, right?
    }

    private void Update()
    {
      
    }
}
2 Likes

I guess it’s not surprising that the same issue occurs with LoadAssetAsync().

:frowning:

1 Like

@unity_bill I’m seeing this issue as well in WebGL builds.

1 Like

I have the same issue. This was also reported before, I think. AsyncOperationHandle.PercentComplete not updating when given as a Parameter in Function

As a workaround, instead of using handle.PerfectComplete < 0.0f, I was able to use
handle.Task.Status != TaskStatus.RanToCompletion. I believe some fixes are coming soon.

2 Likes