Search Unity

Problem of assigning a folder as Addressable

Discussion in 'Addressables' started by optimise, Oct 29, 2018.

  1. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    Seems like currently when u assigning a folder as Addressable, each item inside the folder needs to put not only file name but also its file format in order to load properly. I would like to see file format is no longer needed anymore in future version.

    upload_2018-10-30_1-48-55.png
     
  2. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    973
    Being able to override the default address and label for those assets would also be quite nice.
     
  3. bottledgalaxy

    bottledgalaxy

    Joined:
    Jul 19, 2019
    Posts:
    85
    Another vote for an option to remove the extension!
     
    anisimovdev and KyleOlsen like this.
  4. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,194
    Still and issue. As an alternative, allow the extension when not using the folder path in the key.

    Right now, these two things work:
    Code (CSharp):
    1. string key = “UI/AwesomeMenu.prefab;
    2. string key = “AwesomeMenu”;
    But these don’t work:
    Code (CSharp):
    1. string key = “UI/AwesomeMenu”;
    2. string key = “AwesomeMenu.prefab
    Why?
     
  5. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668
    This is just a guess, not 100% sure, maybe “UI/AwesomeMenu” read as a folder since there is no extension?
     
  6. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,194
    It could be. To be honest, I am testing again and the only thing I can get to work is the full path + .prefab at the end. So I am not sure if I was mistaken before and it is simply that just the file name (without .prefab) will not work, or that I changed a setting somewhere that broke things.

    Has anyone else found just the file name to work as the key, without .prefab, in cases where the address is a full file path?
     
  7. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668
    How I like to think of this is as more of an address (to the local asset within the catalog) than a key. There is also a key and label. If you ever use AssetReference.RuntimeKey you will notice that it is a hash, not a path. So I think those are different things.

    What exactly are you trying to accomplish with this, what is the problem with having the extension?
     
  8. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,194
    The reason is that this is for an asset store product where I need to support different address formats (with folder paths and without), so I was hoping both types would be usable without the file extension. But truly it is not a big deal.

    Mostly I was confused about when .prefab and the full path are necessary, because I swear I had things working with just the file name before, but now if my address has a folder path and extension, Unity is throwing an exception if I don’t include them. So I was hoping for clarification on whether the address used to locate an asset needs to match the address on the addressable asset exactly, or if it is possible to get away with just using the file name (and perhaps I have changed some setting that has disabled this functionality.
     
  9. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668
    Maybe you had it simplified (right click>simplify addressable names).

    What do is have another file (with a specific extension, eg. .parts) with list metadata for each asset (not dependencies). It includes bunch of information including asset type, address, name, title etc... Then I save it at the same location as build location. At runtime, I first find and load all of these (by extension) and create a database.

    This allows me to do a lot of things without having to load the assets first, like displaying details of them on a UI. It is an extra step but it eliminates any confusions down the line for me. Also, my scenario is for a game, not a tool...
     
  10. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,194
    I think you might be right, I probably simplified the names using that option.
     
  11. lleo52

    lleo52

    Joined:
    Apr 8, 2013
    Posts:
    14
  12. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,194