Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Resolved LoadResourceLocationsAsync returns ResourceType null for sub-assets

Discussion in 'Addressables' started by MarkvDrimmelen, Sep 4, 2020.

  1. MarkvDrimmelen

    MarkvDrimmelen

    Joined:
    Oct 13, 2017
    Posts:
    13
    Today I was trying to update our Addressables package to the latest version and everything seemed to work except for loading resource locations for sub-assets. Where before version 1.8.3 the ResourceType was correctly filled, it is now null. It appears that it has been broken for a while, as version 1.7.5 still works, but from version 1.8.3 it's broken.
    The changelog of 1.8.3 has an entry with "Fixed subobject parsing to treat anything between the first '[' character and the last ']' as the subobject name instead of the last '[' and the last ']'." and I suspect that this has introduced the problem.

    Reproduction steps:
    • Create an AssetReference inside a script and assign an asset with a sub-asset through the inspector
    • Call Addressables.LoadResourceLocationsAsync passing in the AssetReference

    Version 1.7.5 (correctly) returns a list with 1 item, ResourceType will be filled with the correct type.
    Version 1.8.3 or higher returns a list with 1 item, ResourceType will be null.

    Instantiating the AssetReference directly seems to work correctly so apparently the usage of sub-assets isn't widely used in combination with the LoadResourceLocationsAsync method. We use the LoadResourceLocationsAsync method because of networking; the server sends the address of the asset the client needs to create. Therefore the client needs to resolve the resource location and determine the ResourceType in order to create either a ScriptableObject or a GameObject. So unless someone has an alternative solution for this usecase that doesn't require the ResourceType to work correctly, I would like to see this fixed.
     
    Last edited: Sep 8, 2020
  2. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    736
    Hey @MarkvDrimmelen can you try updating to 1.15.1? If you look in the Package Manager window and expand the Addressables entry in the list of packages you should see many newer versions than 1.8.3. Let us know if updating doesn't solve your issue. I'm pretty sure that is fixed though.
     
  3. MarkvDrimmelen

    MarkvDrimmelen

    Joined:
    Oct 13, 2017
    Posts:
    13
    Thanks for the reply. Perhaps I should have been more clear about me using the latest actually was 1.15.1. Anyway, the problem is still the same for every version I've tried higher than 1.7.5. So it all comes down to this:

    Code (CSharp):
    1. await Addressables.InitializeAsync().Task;
    2. IList<IResourceLocation> resourceLocations = await Addressables.LoadResourceLocationsAsync(AssetReference).Task;
    Version 1.7.5 will correctly have a ResourceType
    Every version above this that I've tried (including 1.15.1) will have a ResourceType of null.

    This is using the Play Mode Script "Use Asset Database (faster)"

    I've also upated my original post, as the two items returned in the list is no longer relevant.
     
  4. MarkvDrimmelen

    MarkvDrimmelen

    Joined:
    Oct 13, 2017
    Posts:
    13
    Any word on this? It has been two weeks since the last reply. Did this make the backlog, or is more information required?
     
  5. Shaunyowns

    Shaunyowns

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    328
    Hey there!

    Based on this we'd like you to file a bug report if that's okay? - https://unity3d.com/unity/qa/bug-reporting

    Thank you!
     
  6. MarkvDrimmelen

    MarkvDrimmelen

    Joined:
    Oct 13, 2017
    Posts:
    13
    Hi, I'd just like to come back and note that I've filed a bug report and can confirm this has been fixed in version 1.16.10.
     
    TreyK-47 likes this.