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

Loading assets from the parent folder address without label

Discussion in 'Addressables' started by Infenix, Mar 19, 2022.

  1. Infenix

    Infenix

    Joined:
    May 5, 2019
    Posts:
    7
    Hello,
    I'm trying to implement addressables in a project and I feel like I'm missing something. I currently check if an asset exist with
    Addressables.LoadResourceLocationsAsync(keys, mergeMode, type)

    In the addressables groups window, I can assign a label to the folder, which then assigns the same label to every child object. However, if I want to use the addressables name directly instead of a label, it seems I can't just assign a key to the folder and load that key. In this case, no asset gets loaded.

    In the addressables window, the child files of the folder get a name looking like "folderKeyChildFileName", and I would then, I suppose, need to give every file name I want to load (which I don't, I want to be able to simply load the whole folder, giving its addressable name and assets types).

    Is there any way I can achieve this, or this is the exact reason for which labels exist and I have to create a label for each type group of file I want to load at once ?
     
  2. unity_shane

    unity_shane

    Unity Technologies

    Joined:
    Jun 3, 2021
    Posts:
    102
    @Infenix, In general the purpose of labels is for loading specific groups of files, and given that you can have an effectively infinite number of labels, I would recommend using a label for this use case. Is there any particular reason why you don't want to use a label here?

    Edit: looked into this a bit more and I can confirm that using labels here is the intended means of loading everything from a folder marked addressable. We're looking into seeing if there are any UX improvements we can do around the other behaviors with using the address of a folder, but for now I recommend using a label moving forward.
     
    Last edited: Mar 31, 2022
  3. Infenix

    Infenix

    Joined:
    May 5, 2019
    Posts:
    7
    Hello,

    I don't have any need to want to do it this way, but when implementing the system, it felt weird to me. Why can I load one specific asset by its addressable name, but not the whole folder by the same mean ? It didn't feel intuitive. Doing this through labels means I can give the folder a custom addressable key, which may help for readability, but that I can't use in practice.

    However, doing it using labels works fine, I just have to create a label for each folder which is one more step that would not be required if I could load the folder by the key. This is clearly a UX problem and I'm not technically blocked. I think it's something that should be possible, but I'll stick with labels as the end result is the same.

    Thanks for your answer !
     
    wethings likes this.
  4. wethings

    wethings

    Joined:
    Aug 26, 2018
    Posts:
    28
    Yup I am facing the same problem here. I dont want to use labels. I've organised my assets into folders and I just want to load the whole folder by its address.

    Having thousands of folders means I have to have thousands of labels which is just opening a chance of mis-labelling.
     
  5. pillakirsten

    pillakirsten

    Unity Technologies

    Joined:
    May 22, 2019
    Posts:
    346
    Hi all thanks for the feedback! This is especially useful as we are looking into improving the Addressables UX
     
    Infenix and wethings like this.