Search Unity

Clear cached content catalogs

Discussion in 'Addressables' started by ProtoTerminator, Jun 12, 2020.

  1. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    586
    How do you clear cached content catalogs?

    I loaded in a separate catalog in editor:

    Code (CSharp):
    1. Addressables.LoadContentCatalogAsync($"{SharedAssetPath}/{Platform}/catalog_shared.json")
    Then I deleted that entire folder where the catalog resides and ran it again, and much to my surprise, it still loaded without any errors.
    I tried
    Caching.ClearCache()
    and
    Addressables.ClearResourceLocators()
    , but neither did the trick.
    I even tried changing the path to the catalog, and it still loaded in! The only thing that made it not load in was when I changed the name of the catalog
    catalog_something_else.json
    . That makes it seem like Addressables splits the path and only checks if
    catalog_shared.json
    is stored in the cache and loads that... which makes absolutely no sense!

    So this is partly a question for how to clear cached catalogs, and partly feedback on what to me seems to be a bug.

    How am I supposed to know if the loaded catalog is even the latest or loaded from the path I gave it with this kind of behavior?

    Unity 2019.1.14, Addressables 1.10.0, running on OSX

    @unity_bill
     
  2. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,822
  3. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    586
  4. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    586
    Got this response from QA:

    I understand the reasoning for that, however, I think it's too restrictive. I suggest adding an option to provide a cache key instead of only using the file name (fallback to file name if cache key is not provided). That way same name catalogs at different paths can still be properly supported.

    A way to clear the addressables cache is also needed!

    [EDIT] Also, please add this to the documentation!
     
  5. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,822
    Thanks for the update, and for the feedback! I'll be sure to share it with the team.
     
  6. better_walk_away

    better_walk_away

    Joined:
    Jul 12, 2016
    Posts:
    291
    Caching.ClearCache()
    doesn't work because this method clears the caches that reside in the Application.temporaryCachePath, while the catalog_shared.json and catalog_shared.hash are stored under Application.persistentDataPath.
     
  7. tomkail_betterup

    tomkail_betterup

    Joined:
    Nov 17, 2021
    Posts:
    106
    Is there any update on this? Understanding how Addressables (esp with WebGL) are cached and how to manage this is super undocumented.