[0.7.4] Addressables.DownloadDependencies: PercentComplete always returns 0

Hello,

I've upgraded from 0.6.8 to 0.7.4 to get an Addressables.GetDownloadSize() that takes already cached AssetBundles into account (which works, hurray), but now the following code displays 0 every frame until it's done:

var downloadDependenciesOp = Addressables.DownloadDependencies(label.labelString);
while (!downloadDependenciesOp.IsDone)
{
     Debug.Log(downloadDependenciesOp.PercentComplete);
     yield return null;
}

Debug.Log("Done!");
}

This was working with 0.6.8.

1 Like

we'll look into it. thanks.

Just to double check, you are doing this in a player (not in the editor) and the bundles are up on some server, right? And the Debug.Log(downloadDependenciesOp.PercentComplete); gets called many times?

This is happening both in the editor and the Android player if I remember correctly, and the bundles are indeed up on some server. The exact same code was printing proper percentages with 0.6.8, so you can (probably) rest assured that the code is working correctly.

And I should've specified: This is part of a coroutine. So yes, "Debug.Log(downloadDependenciesOp.PercentComplete);" gets called many times (and prints 0 every time until the whole operation is done).

1 Like

Got it, just had to check :)

2 Likes

Still seems to be a problem with 1.1.4

2 Likes


Hi Bill, If you have some spare time, could you help me with this problem. thank you!
https://discussions.unity.com/t/748369

Yes @David_GameDev and @unity_bill
same for me v1.1.4.

  • Scene "Main" is in a server remotly.
  • Play Mode Script = Packed Play Mode

The scene takes a time to be loaded and just "0" are showed.

My example:

IEnumerator LoadMainScene()
    {
        AsyncOperationHandle<SceneInstance> tmp = Addressables.LoadSceneAsync("Main");
        tmp.Completed += OnLoadSceneCompleted;

        while (!tmp.IsDone)
        {
            print("Update: " + tmp.PercentComplete);
            yield return null;
        }
    }
2 Likes

Hi everybody,

A workaround that works for me is:

operation.GetDependencies(deps);

float percentComplete = 0;

for (int i = 0; i < deps.Count; ++i)
{
percentComplete += deps*.PercentComplete;*
}
percentComplete /= deps.Count;
Cheers!

1 Like

[quote=“CristianGarciaJ”, post:9, topic: 740904]
Hi everybody,

A workaround that works for me is:

operation.GetDependencies(deps);

float percentComplete = 0;

for (int i = 0; i < deps.Count; ++i)
{
percentComplete += deps*.PercentComplete;*
}
percentComplete /= deps.Count;
Cheers!
[/quote]

Where are you getting deps?

1 Like

From the AsyncOperationHandle

1 Like

@CristianGarciaJ could you explain this line in more detail?

operation.GetDependencies(deps);

1 Like

[quote=“CharBodman”, post:10, topic: 740904]
Where are you getting deps?
[/quote]
[quote=“fabioColombini_1”, post:12, topic: 740904]
@CristianGarciaJ could you explain this line in more detail?

operation.GetDependencies(deps);
[/quote]

I think this is more clear:

  private static float calculatePercentComplete(AsyncOperationHandle asyncOperation)
        {
            var deps = new List<AsyncOperationHandle>();
            asyncOperation.GetDependencies(deps); // deps is added to! (weird API...)
            float percentCompleteSum = 0;
            foreach (var asyncOperationHandle in deps)
            {
                percentCompleteSum += asyncOperationHandle.PercentComplete;
            }
            return percentCompleteSum / deps.Count;
        }
4 Likes

Yes, the response of faolad is correct.

Sorry for the misunderstanding :)

1 Like

Unfortunately this is still broken in 1.1.5.

[quote=“faolad”, post:13, topic: 740904]
I think this is more clear:

  private static float calculatePercentComplete(AsyncOperationHandle asyncOperation)
        {
            var deps = new List<AsyncOperationHandle>();
            asyncOperation.GetDependencies(deps); // deps is added to! (weird API...)
            float percentCompleteSum = 0;
            foreach (var asyncOperationHandle in deps)
            {
                percentCompleteSum += asyncOperationHandle.PercentComplete;
            }
            return percentCompleteSum / deps.Count;
        }

[/quote]

I believe this will always return 1 if you use a single label to load multiple dependencies.
I’m going to have to test it some more.

The same, operation should return progress of all dependencies.

Report a bug please. Unity has a team helps reproduce bug, and then goes into their internal progress quickly.

Forum is also helpful for discussion and avoiding duplicated report though.

1 Like

basicly, the only thing i want to know is loading progress of asset, which from 0 to 1. and I don't care about percentComplete. unity should provide a property like handle.progress.

1 Like

still same problem in asset bundles progress is not good showing from 0 to 1.

1 Like

this problem still exit in 1.1.10

2 Likes