Search Unity

Error when loading asset after using PreloadDependencies

Discussion in 'Addressables' started by khan-amil, Jan 25, 2019.

  1. khan-amil

    khan-amil

    Joined:
    Mar 29, 2012
    Posts:
    206
    Hi, I'm digging around with the addressable system (v0.5.3) and so far I tried the following scenario :

    1) Preload everything with a certain label, likely during a loading screen.
    2) Load needed resources in the scene as we need. With AssetReferences each calling LoadAsset.

    The issue is that when calling LoadAsset, if the asset in question was in the label that we preloaded, I get the following error :

    Code (CSharp):
    1. ArgumentException: An item with the same key has already been added. Key: E:/MagicLib/Assets/StreamingAssets/com.unity.addressables/StandaloneWindows64/defaultlocalgroup_assets_all.bundle
    2. System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    3. System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    4. UnityEngine.ResourceManagement.VirtualAssetBundleManager.LoadAsync (UnityEngine.ResourceManagement.IResourceLocation location) (at Library/PackageCache/com.unity.resourcemanager@2.4.4-preview/Runtime/ResourceProviders/Simulation/VirtualAssetBundleManager.cs:82)
    5. UnityEngine.ResourceManagement.VirtualAssetBundleProvider+InternalOp`1[TObject].<.ctor>b__4_0 (UnityEngine.ResourceManagement.IAsyncOperation`1[T] op) (at Library/PackageCache/com.unity.resourcemanager@2.4.4-preview/Runtime/ResourceProviders/Simulation/VirtualAssetBundleProvider.cs:45)
    6. UnityEngine.ResourceManagement.VirtualAssetBundleProvider+InternalOp`1[TObject].Start (UnityEngine.ResourceManagement.VirtualAssetBundleManager mgr, UnityEngine.ResourceManagement.IResourceLocation location, UnityEngine.ResourceManagement.IAsyncOperation`1[T] loadDependencyOperation) (at Library/PackageCache/com.unity.resourcemanager@2.4.4-preview/Runtime/ResourceProviders/Simulation/VirtualAssetBundleProvider.cs:83)
    7. UnityEngine.ResourceManagement.VirtualAssetBundleProvider.Provide[TObject] (UnityEngine.ResourceManagement.IResourceLocation location, UnityEngine.ResourceManagement.IAsyncOperation`1[T] loadDependencyOperation) (at Library/PackageCache/com.unity.resourcemanager@2.4.4-preview/Runtime/ResourceProviders/Simulation/VirtualAssetBundleProvider.cs:105)
    8. UnityEngine.ResourceManagement.CachedProvider.Provide[TObject] (UnityEngine.ResourceManagement.IResourceLocation location, UnityEngine.ResourceManagement.IAsyncOperation`1[T] loadDependencyOperation) (at Library/PackageCache/com.unity.resourcemanager@2.4.4-preview/Runtime/ResourceProviders/CachedProvider.cs:583)
    9. UnityEngine.ResourceManagement.ResourceManager.ProvideResource[TObject] (UnityEngine.ResourceManagement.IResourceLocation location) (at Library/PackageCache/com.unity.resourcemanager@2.4.4-preview/Runtime/ResourceManager.cs:94)
    10. UnityEngine.ResourceManagement.GroupOperation`1[TObject].Start (System.Collections.Generic.IList`1[T] locations, System.Action`1[T] callback, System.Func`2[T,TResult] func) (at Library/PackageCache/com.unity.resourcemanager@2.4.4-preview/Runtime/AsyncOperations/AsyncOperationBase.cs:474)
    11. UnityEngine.ResourceManagement.ResourceManager.ProvideResources[TObject] (System.Collections.Generic.IList`1[T] locations, System.Action`1[T] callback) (at Library/PackageCache/com.unity.resourcemanager@2.4.4-preview/Runtime/ResourceManager.cs:109)
    12. UnityEngine.ResourceManagement.ResourceManager.LoadDependencies (UnityEngine.ResourceManagement.IResourceLocation location) (at Library/PackageCache/com.unity.resourcemanager@2.4.4-preview/Runtime/ResourceManager.cs:252)
    13. UnityEngine.AddressableAssets.Addressables.LoadAsset[TObject] (System.Object key) (at Library/PackageCache/com.unity.addressables@0.5.3-preview/Runtime/Addressables.cs:516)
    14. UnityEngine.AddressableAssets.AssetReference.LoadAsset[TObject] () (at Library/PackageCache/com.unity.addressables@0.5.3-preview/Runtime/AssetReference.cs:153)
    15. ResourcesLoader.GetPrefab (UnityEngine.AddressableAssets.AssetReference reference) (at Assets/MagicTools/MagicLib/Scripts/LoadingManagement/ResourcesLoader.cs:86)
    16. AdressableTeste.Update () (at Assets/AdressableTeste.cs:31)
    Is this a setup issue? It's possible I'm misreading the intended flow for these functions, but it looked like a god fit.
    Otherwise it looks like I'm left with having to maunally load each AssetReferenc during the loading screen?
     
  2. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Two things:
    1. in the next release we'll have a DownloadDependencies API that should avoid this.
    2. Seems like we may have a bug. Were you in Virtual mode? Does it matter if the groups are setup to be local or remote?

    -Bill