Addressables 2.3.16 null exception in Addressables.LoadAssetAsync<GameObject>()

Hello

Enterprise customer here (rather an urgent matter) and we are having an issue with the Addressables 2.3.16 on Unity 6-2-Alpha, WebGl. We tried earlier releases and results are the same.

Per Karl Jones earlier recommendations we did clean builds of all kinds. Result reaming the same. It could be a bad piece of code at my end after all.

The below class issues a null reference around the line:

        AsyncOperationHandle<GameObject> handle =
            Addressables.LoadAssetAsync<GameObject>(location);
  1. Error pasted at the every end
  2. a.out file post build from the usual webgl build directory attached

IEnumerator loadexternal0()
{
IEnumerable keys = new List() { “marie1”, “car_piston”};

    //https://docs.unity3d.com/Packages/com.unity.addressables@2.3/manual/load-assets-location.html



    //turns the strings to locations
    AsyncOperationHandle<IList<IResourceLocation>> locations = Addressables.LoadResourceLocationsAsync(keys,
    Addressables.MergeMode.Union, typeof(GameObject));

    yield return locations;


    var loadOps = new List<AsyncOperationHandle>(locations.Result.Count);

    Debug.Log("locations.Result= "+ locations.Result.Count);


    foreach (IResourceLocation location in locations.Result)
    {

        Debug.Log(location.PrimaryKey);

        AsyncOperationHandle<GameObject> handle =
            Addressables.LoadAssetAsync<GameObject>(location);


        yield return handle;

   

        handle.Completed += obj => operationDictionary.Add(location.PrimaryKey, obj);

        // handle.Completed += obj => { Addressables.InstantiateAsync(obj); };


        // handle.Completed += obj => { operationDictionary.Add(location.PrimaryKey, obj); Addressables.InstantiateAsync(obj); };

    }

    yield return Addressables.ResourceManager.CreateGenericGroupOperation(loadOps, true);

}

System.NullReferenceException: Object reference not set to an instance of an object
at UnityEngine.ResourceManagement.AsyncOperations.ProviderOperation1[TObject].Execute () [0x00061] in ./Library/PackageCache/com.unity.addressables@1d7f6a740e58/Runtime/ResourceManager/AsyncOperations/ProviderOperation.cs:242 UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase 1/<>c__DisplayClass60_0<System.Collections.Generic.IList1<UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle>>:<add_CompletedTypeless>b__0 (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle 1<System.Collections.Generic.IList1<UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle>>) DelegateList 1<UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle1<System.Collections.Generic.IList 1<UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle>>>:Invoke (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle1<System.Collections.Generic.IList 1<UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle>>) (at ./Library/PackageCache/com.unity.addressables@1d7f6a740e58/Runtime/ResourceManager/Util/DelegateList.cs:75)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase1/<>c__DisplayClass60_0<UnityEngine.ResourceManagement.ResourceProviders.IAssetBundleResource>:<add_CompletedTypeless>b__0 (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle 1<UnityEngine.ResourceManagement.ResourceProviders.IAssetBundleResource>)
DelegateList1<UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle 1<UnityEngine.ResourceManagement.ResourceProviders.IAssetBundleResource>>:Invoke (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<UnityEngine.ResourceManagement.ResourceProviders.IAssetBundleResource>) (at ./Library/PackageCache/com.unity.addressables@1d7f6a740e58/Runtime/ResourceManager/Util/DelegateList.cs:75)
UnityEngine.AsyncOperation:InvokeCompletionEvent () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/AsyncOperation.cs:24)

aa.zip (6.2 KB)

In looking at the Catalog you attached it looks like you have the AssetBundleProvider, but not the BundledAssetProvider specified:

"m_ProviderIds" : [
      "UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider"
   ],

They are tounge-twisters to talk about, but the AssetBundleProvider downloads the asset bundles. And the BundledAssetProvider knows how to get the assets out of the asset bundles. So I think you’re missing the second one which is causing the issues.

My settings look like this:

image

And the output in my catalog ends up looking like this:

  "m_ProviderIds" : [
      "UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider",
      "UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider"
   ],

Does changing that in your Settings fix your problem?

1 Like

OMG Mr. Tim do you remember me? You helped me several years back with the first issue for CCD+addressables:) Thank you again for caring to respond.

I will check what you suggest, could you tell me precisely WHICH setting is the required change is?

I found the UI, I am testing now

First try all worked, this being WebGL let me do a couple of builds and tests and will get back to you.

Thank you as always perfect service

1 Like

Fresh WebGL build and all worked.

Please 1) alter the tag on this post to question vs. bug or something more applicable, 2) RESOLVED status and thank you.

Thank you and last request: how I can make sure the Addresesables asset was a ctually downloaded from the CCD and did not use any of the local materials and what not.

fully tested, some benign errors show up but that is not Unity’s.

Use any browser:

in the input box enter please

ff/free/ccdtest + mimi

the mimi character is now replaced by the chubby marie1.

question: I need to inspect the runtime session like this case and see what comes from CCD cloud into the Unity runtime environment.

My goal is not performance tuning, my goal is to make sure the textures and other large size content are not downloaded. And need to make sure I understand what CCD sends to the runtime binary , either on the CCD panel or other means .

Thank you

Hi @darashayda,

I’m glad I’ve been able to help you over the years! It’s definitely one of the parts of the job I like best.

As for making sure you’re not getting cached data. Since this is a web browser there are a few techniques. You can open devtools in your browser and click “Disable cache”

image

This should make sure that you are always downloading the content. I do know that WebGL is a bit of a special case when it comes to caching asset bundles. Rather than cache the bundles, the actual http requests are stored in a local cache and are then replayed when the content is downloaded.

Thank you. I have another 1 to 2 possible questions, I will mention here but a new post and kindly for you to consider them.

Now for the CCD goodies:

Once the first scene shows please enter the following path into the input box

ff/free/ccdtest + eva

Every item on that scene are obtained from CCD!

Most of the character and asset C# code is runtime compiled, neither the assets nor the specific C# classes are a part of the usual Unity Editor build.

Please kindly:

  1. Close this ticket
  2. Remove my BUG tag
  3. Tag as RESOLVED

We are testing and possibly 1 or 2 items might need your assistance

Dara