Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Regression in loading a folder with sprites

Discussion in 'Addressables' started by Cardinal90, Jun 9, 2020.

  1. Cardinal90

    Cardinal90

    Joined:
    Aug 9, 2017
    Posts:
    15
    Starting with v1.9.2 I have a problem when loading a folder with sprites. It is similar to Case 1202034 https://issuetracker.unity3d.com/is...-a-folder-and-using-asset-database-build-mode, but happens only in a built player and when "Use Existing Build" play mode script is chosen.

    To clarify, I have a folder containing several sprites. It is marked as addressable with an address "Icons/Items" and has a label "Items". I load it with `await Addressables.LoadAssetsAsync<Sprite>("Items", null).Task`. It worked in 1.3.8, then stopped working in 1.4.x and was fixed in 1.8.3. Now since 1.9.2 it works in play mode with "Use Asset Database" but throws in a player:

    Exception encountered in operation UnityEngine.ResourceManagement.ResourceManager+CompletedOperation`1[System.Collections.Generic.IList`1[UnityEngine.Sprite]], result='', status='Failed': Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=Items, Type=UnityEngine.Sprite

    On another note, it is very tedious to mark a folder as addressable, then switch to another interface, create a label (often with the same name) and assign it. It would be great to be able to use the folder's address to load assets. If that is impossible, please consider adding a `Labels` dropdown into an asset's inspector below the `Addressable` checkbox.
     
  2. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,816
  3. Cardinal90

    Cardinal90

    Joined:
    Aug 9, 2017
    Posts:
    15
    Well, I tried to reproduce in a new project and couldn't. The bug is still present in the main project though :(. I might upload it into a bug report at some point, but would prefer not to.
     
  4. GilbertoBitt

    GilbertoBitt

    Joined:
    May 27, 2013
    Posts:
    111
    thats the same problem i'm having.. when using Addressables.LoadAssetsAsync i receive bug but when using AssetReference.LoadAsync it work normally.

    that's the reason i'm using foreach instead of loadAssetsAsync
     
  5. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    699
    Any update on this? I am seeing this issue as well. I have found that it works when I use
    Code (CSharp):
    1. Addressables.LoadAssetAsync<Object>(address);
    which will load a Texture2D

    but not

    Code (CSharp):
    1. Addressables.LoadAssetAsync<Sprite>(address);
    (InvalidKeyException is thrown)