AsyncOperationHandle.PercentComplete not updating when given as a Parameter in Function

Since 0.7.4 I´ve got a Problem with my loading screen. What I have been doing sofar was a simple Loadingscreen, with the function

public IEnumerator ShowProgress(AsyncOperationHandle op)
    {
             //this also seemingly doesn´t work anymore. What I currently do, just for testing is instead of GetDownloadSize(op) I replace the op with the actual object key, at least for now.
             Addressables.GetDownloadSize(op).Completed += (AsyncOperationHandle<long> getValue) => { Downloadsize = getValue.Result; finishedGettingInfo = true; };
             yield return new WaitUntil(() => finishedGettingInfo);

        while (op.PercentComplete < 1)
        {
             progressBar.value = op.PercentComplete;
             txtProgress.text = string.Format("{0:0.00}mb / {1:0.00}mb", (op.PercentComplete / 1000000) * 100, Downloadsize / 1000000);            
             yield return new WaitForSeconds(0.01f);
        }
  }

Pretty simple loading screen which worked for any Addressables Load I had. However, since 0.7.4, the op.PercentComplete doesn´t update at all. It only updates when the operation is basically done and op.PercentComplete = 1; It worked before IAsyncOperation got replaced with AsyncOperationHandle. Any advice whether I just have an error in the code now or if I need a new approach for this because maybe the AsyncOperationHandle doesn’t work exactle the same as it did before as IAsyncOperation.
And is it possible to get the object Key from AsyncOperationHandle?

Thanks in advance

1 Like

Same here. Using Addressables 7.5 Please advise. :hushed:

@unity_bill , you are our only hope!

this.asyncOperationObjectLoad = this.experienceAsset.Instantiate();

if (!this.onCompleteCreated)
{
     this.onCompleteCreated = true;
     this.asyncOperationObjectLoad.Completed += OnObjectLoaded;
}

void Update()
{
        if (!this.isLoading)
            return;

        if (this.onCompleteCreated)
        {
            this.progressBar.SetValue(this.asyncOperationObjectLoad.PercentComplete);
        }
}

0.8.4. Still same Problem, PercentComplete from AsyncOperationHandle - Parameter not updating.

1 Like

seems the same as: [0.7.4] Addressables.DownloadDependencies: PercentComplete always returns 0

we’re looking into it.

2 Likes

@unity_bill Any word on the progress complete issue? We’re about ready to ship a product and were hoping there might be a solution by now. Thanks!

3 Likes

Using Addressables 1.1.5, is there a way to cancel a AsyncOperationHandle?

I tried some of the following approaches, but no luck…

private AsyncOperationHandle asyncOperationObjectLoad;

public void LoadExperience()
{
          this.onCompleteCreated = true;//flag for Update()

          this.asyncOperationObjectLoad = this.experienceAsset.Instantiate();

          this.asyncOperationObjectLoad.Completed += OnObjectLoaded;
}

public void DestroyLoadedAssets()
{
        if (this.loadedExperience != null)
        {
            Addressables.Release(this.loadedExperience);
        }
       
        this.onCompleteCreated = false;

        this.asyncOperationObjectLoad.Completed -= OnObjectLoaded;//doesn't work

        StopAllCoroutines();//doesn't work

        this.asyncOperationObjectLoad = new AsyncOperationHandle();//doesn't work
}

Also, still not able to get a value for AsyncOperationHandle.PercentComplete. Is there some sort of workaround?

For that matter, I’m doing the potential code in an Update loop, which is pretty janky to begin with. Is there a AsyncOperationHandle.onProgress or .onLoad to register to?

private void Update()
{
        if (!this.isLoading)
            return;

        if (this.onCompleteCreated)
        {
            this.progressBar.SetValue(this.asyncOperationObjectLoad.PercentComplete);
        }
        else
        {
            this.progressBar.SetValue(0);
        }
}

@unity_bill Or any other Unity staff. Any help would be much appreciated. Thank you!

We had fixed some case earlier, but tracked down what should be the main failing scenario recently. The fix is in our repo and will be in the next release.

not yet. We’ve looked into it. The problem is that some things you can do through addressable are cancel-able. Some not. So we haven’t added this yet as we can’t actually guarantee a reasonable behavior.

no. the main thing that will ever have progress is the download. for that we’re wrapping https://docs.unity3d.com/ScriptReference/Networking.UnityWebRequest.html which has no “on progress” callback. The update loop is probably the best place to work with that.

Hey Bill , Do you have a rough estimation when this next release will be? We’re trying to launch a production game asap and we need this PercentComplete bug fixed :face_with_spiral_eyes:.

Thanks !

Either next week or the week after. Things are a little hard to nail down as a lot of the team is in and out on vacation over the summer. But I’m targeting fairly soon

1 Like

this is still an issue for me , is there any news ?

is working now for me with Addressables v. 1.1.7

i only get some value ex: 0.33, then 0.8, then 1
not real progress
is that what you got ?

1 Like

No, actually i got a smooth progress from 0 to 1 ( 0.1,… 0.45,… 0.6…0.8… 1), im using a progress bar and is working fine.

:::>_<::: I got the same problem

When I use Addressables.GetDownloadSizeAsync
the AsyncOperationHandle.PercentComplete is always 1

Hey @Bobbiii GetDownloadSizeAsync doesn’t actually download anything, it just checks the location data for the download size. If Addressables is initialized this is basically a synchronous operation. The only reason you might see anything different than 1 on this operation is if Addressables hasn’t finished initialization and we chain the GetDownloadSizeAsync op with the init op.

@essamri what API are you using that you’re checking the progress of? I can take a look at how that specific operation works and make sure we haven’t missed something.

1 Like

Do you have any updates on cancelling the AsyncOperationHandle? I’m creating a game with 3 HUGE stages and pre-loading them before the user selects a stage to play, my goal is to stop the other two and continue downloading the requested stage.

1 Like

Yes, we need a way to get a good progress of the download

I am still experiencing download percentages being only 0 or 1. There are no progress, even normalized.

  • Is there anyway to get download percentages? I still get just 0 or 1.