Search Unity

AssetReference vs Key (label)

Discussion in 'Addressables' started by FlightOfOne, Oct 21, 2020.

  1. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668
    I know how to load assets using both of those methods but what are the benefits of each method?

    When should you use keys and when should you use asset reference, pros and cons?

    Cheers!
     
    dominator909 and chino01 like this.
  2. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668
    So, I have been digging around bit more and it seems you can only use Asset References for locally available content. If the location you are calling it from do not know about it (e.g. a remote catalog) you have to use the keys.
     
  3. therobby3

    therobby3

    Joined:
    Jan 30, 2019
    Posts:
    131
    I don't think one was necessarily entirely better than the other, I suppose it's a matter of preference. However me personally, if I had to pick I'd say using AssetReference is better, that way you can change the name and such of the addressable and it won't break the linkage. It's generally what I prefer. Although if loading by a key better fits your scenario, there should be no problem with that either.
     
  4. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668
    See here: https://forum.unity.com/threads/usi...ad-asset-storage-locally.990986/#post-6451556

    Its been a few days since I asked this question and I have been digging around and testing a lot since. What I found is it works really well if they are in one (single) project but if your content is in separate project, you can't use these to reference them as your main project has no clue where these are. Latter is my case, so I ended up using labels. I will probably use a ScriptableObject to store these keys in my main project. Sort of like my own version of AssetRefs.
     
    Last edited: Mar 14, 2022