Search Unity

Bug Using box brackets [] in address prevents asset from loading

Discussion in 'Addressables' started by Noblauch, Nov 2, 2020.

  1. Noblauch

    Noblauch

    Joined:
    May 23, 2017
    Posts:
    275
    When using box brackets in an address (in my case: "fonts/materials/Settings/Email Register Title [PP]") the addressables system won't find the asset.

    It took me quite some hours to figure out why this one address won't load after a bigger refactoring until I noticed this very evil bug.

    Easily reproducible:
    Make anything addressable with this address: "myAddress [Bug]"
    Then in code run:
    Code (CSharp):
    1. string address == "myAddress [Bug]";
    2. var asset =  await Addressables.LoadAssetAsync<T>(address).Task;
    3.  
    4. if(asset == null) Debug.Log("Didn't find it");
    PS: We are using the [PP] tag to indicate that an asset needs post processing to function correctly (if you were curious)
     
  2. LuGus-Jan

    LuGus-Jan

    Joined:
    Oct 3, 2016
    Posts:
    179
    I have the impression that it's not a bug. It's used to access sub-assets in a Sprite Atlas for example.

    I've ran into this myself because we use the Horizon[ON] package, and some prefabs are built using this package which are referenced in Addressables. For now, we had the luxury to just exclude these and have them being duplicated in the bundle builds themselves. I'd rather just rename these without the brackets, but some rely on file/path names to retrieve assets, so it's not always an option.

    I'd love to see them add a checkbox on the
    AddressableAssetEntry
    class or something to mark them as being a sub-asset or something, so that names that do legitimately have brackets in them can work as intended still in the Addressables package.
     
  3. Noblauch

    Noblauch

    Joined:
    May 23, 2017
    Posts:
    275
    Hm, yes I see what you mean.
    But a sub system should never break the base system. I guess since there is a lot going on, the developers just didn't think of this case. As you mentioned, sometimes for example if you rely on third party packages, you can't even change the name, since you would never be able to update again.

    We will change the brackets for now, since it's our own convention. But this also means renaming all addresses in all scenes and all prefabs that use this string, which is of course an annoying inconvenience :/
     
  4. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668
    I ran into the same issue. Just ended up changing it to something else.
     
  5. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,822
    I'll forward your feedback to the team! Thanks, guys!