The AsyncOperationStatus.Status are different between first load and second load

Yesterday night , I found a bug in Addressables [1.1.10] :eyes:

When I loading error path , AsyncOperationStatus told me “None” , and try loading again AsyncOperationStatus told me “Failed” , I think the second status is right or the first status is a bug .

What’s the different between first load and second load ? ?

TestCode: Sampe1.cs

The First Click !

Then Click The Button Again ! We can see the “Right Error Info” , Status is Failed .

5846344--620806--upload_2020-5-14_14-31-47.png
5846344–620809–Sampe1.cs (1.2 KB)

I found out the different between first load and second load , in fact when i click the load button , Addressable will execute InitializeAsync (the function is delay execute) . when i click load button again InitializeAsync function are complete . so the AsyncOperationStatus is right.

IEnumerator loadRes()
{
    yield return Addressables.InitializeAsync();
  
    var operationHandle = Addressables.LoadAssetAsync<GameObject>(loadPath);

    Debug.Log(operationHandle.Status.ToString());

    if (operationHandle.Status == AsyncOperationStatus.Failed)
    {
        Debug.Log("load failed");
        yield break;
    }
}

if you want to load asset like this, must run [ Addressables.InitializeAsync() ] function first.

Goodnight !

1 Like

It’s mentioned in the docs (Class Addressables | Addressables | 1.8.5) that Addressables will be initialized on the first API call if Addressables.InitializeAsync() is not called explicitly. It looks like a bug anyway.