Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Load multiple local content catalogs

Discussion in 'Addressables' started by Mese96, Jun 26, 2020.

  1. Mese96

    Mese96

    Joined:
    Jul 23, 2013
    Posts:
    40
    We have multiple exported bundles with an catalog each.
    With following data structure in the end:
    Content
    CoolContent
    catalog_CoolContent.hash
    catalog_CoolContent.json
    CoolContent_scene_all.bundle
    CoolContent_unitybuiltinshaders.bundle
    RandomStuff
    catalog_RandomStuff.hash
    catalog_RandomStuff.json
    RandomStuff_scene_all.bundle
    RandomStuff_unitybuiltinshaders.bundle

    The CoolContent as well as the RandomStuff bundle each have an "loadable_scene".

    Each loaded individualy works fine.

    But if we load the "loadable_scene" from the CoolContent first and from RandomStuff afterwards, it searches in the wrong path.
    The ResourceLocator tries to load "Path/To/Content/CoolContent/RandomStuff_scene_all.bundle"

    We are using 2019.4.0f1 and Addressables 1.8.4
     
  2. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    583
    I had this same problem when I was trying to implement multiple catalogs. I found that the asset path is baked into the catalog at build time, so if you have a runtime path that 2 catalogs use like
    {AssetManager.AssetPath}/[BuildPath]
    , they will both try to load from whatever your
    AssetManager.AssetPath
    is, regardless of where you loaded your catalog from. So to solve for this, I added another runtime path for the external content I wanted to load
    {AssetManager.ExtraAssetPath}/[BuildPath]
    , then I set that new path to the same directory I loaded the catalog from, and that solved the issue for me.

    [EDIT] (You can also bake in your extra content path if you know what it is and it will never change)
     
  3. Mese96

    Mese96

    Joined:
    Jul 23, 2013
    Posts:
    40
    If it is a problem of the catalog itself, one catalog should never work, right ?
    The thing is, if I load "loadable_scene" from RandomStuff first, it works, but than it gets CoolContent wrong.
    (Whatever is loaded first works, what is loaded second does not)
     
  4. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    583
    Try updating to the latest Addressables version (currently 1.11.2)
     
  5. Ardito92ITA

    Ardito92ITA

    Joined:
    Apr 1, 2014
    Posts:
    37
    I have the same problem, I'm going crazy!
     
  6. LuGus-Jan

    LuGus-Jan

    Joined:
    Oct 3, 2016
    Posts:
    179
    @Mese96 I was wondering how and where you can setup these multiple catalogs. Could you give me some hints or point me in a direction where to start looking for this? Thanks!
     
  7. Mese96

    Mese96

    Joined:
    Jul 23, 2013
    Posts:
    40
    @LuGus-Jan
    We did just setup one group with content, exported it, than cleaned it, added the content for the second catalog and exported again. But our use case is to export content from different external projects, to load it in one single project.
     
  8. Mese96

    Mese96

    Joined:
    Jul 23, 2013
    Posts:
    40
    Done. Something new there what would be important in this case ?
     
  9. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    583
    Based on your explanation of the issue, and that updating the package didn't fix it, I think you should file a bug report.
     
  10. Mese96

    Mese96

    Joined:
    Jul 23, 2013
    Posts:
    40
    I figured it out some minutes ago.
    Fortunately I don't have to file a bug report.

    The culprit were the caching of evaluated strings.
    As the asset bundles can be at an user defined location in the asset bundle, we defined some string {AssetManager.AssetPath}.
    This variable is set before loading a new AssetBundle.
    But Unity caches this string instead of evaluating it everytime we load something.


    This could be solved by calling "AddressablesRuntimeProperties.ClearCachedPropertyValues();"
     
    Last edited: Jul 6, 2020
  11. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    583
    Ah yeah that makes sense. That's why I suggested to use a separate runtime path defined in your
    {}
    for each catalog.