Search Issue Tracker

Won't Fix

Votes

0

Found in [Package]

1.10.0

Issue ID

ADDR-1295

Regression

No

Addressables method LoadAssetsAsync throws exceptions when passing an array of AssetReference from Scriptable Object

Package: Build Pipeline - Addressables

-

How to reproduce:
1. Open the attached project (LoadAssetsAsync.zip)
2. Open the Scene 'SampleScene'
3. In the Project window select 'New Scriptable Object Test' and make sure that it has the field 'GameObjects' set to address1 and address2
4. Enter Play Mode

Expected result: LoadAssetsAsync is called and no exceptions get printed to the Console window
Actual result: 2 exceptions get printed to the Console window

Reproducible with: 0.8.4-preview (2019.4.2f1), 1.1.5 (2018.4.24f1), 1.10.0 (2019.4.2f1, 2020.1.0b13, 2020.2.0a16)
Could not test with package versions: 0.7.5-preview and below ( 'Addressables' does not contain a definition for 'LoadAssetsAsync')

Notes:
error 1:
Exception encountered in operation UnityEngine.ResourceManagement.ResourceManager+CompletedOperation`1[System.Collections.Generic.IList`1[UnityEngine.GameObject]], result='', status='Failed': Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=UnityEngine.AddressableAssets.AssetReference[], Type=UnityEngine.GameObject
error 2:
Exception encountered in operation UnityEngine.AddressableAssets.Initialization.InitializationOperation, result='', status='Succeeded' - Chain<IList`1>: ChainOperation of Type: System.Collections.Generic.IList`1[UnityEngine.GameObject] failed because dependent operation failed
Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown

  1. Resolution Note:

    message for customer:

    the current API does not support taking a list of references. So in a way, this is "as designed". That being said, we know it's not ideal, so we have a ticket in our backlog for adding another override of LoadAssetsAsync that will take a list of AssetReferences. Closing out this ticket as there is a workaround (outlined below) and we have plans of eventually extending the API...

    workaround:
    List<AssetReference> refs = new List<AssetReference>();
    List<object> objs = refs.ConvertAll(singleRef => { return (object)singleRef; });
    Addressables.LoadAssetsAsync<GameObject>(objs, null, Addressables.MergeMode.Union);

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.