Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Removing local catalog from m_ResourceLocators

Discussion in 'Addressables' started by Pe1man, Nov 6, 2020.

  1. Pe1man

    Pe1man

    Joined:
    Jan 10, 2016
    Posts:
    18
    Trying to set up custom catalog delivery system. Basically I am downloading catalog on my own and Initializing it via Addressables.LoadContentCatalogAsync($"file://{whatever}). But once I call Addressables.InstantiateAsync(prefabAddress), it goes to search for a given key in the resource locators and simply retrieves the first hit, which is a hit in a local catalog. So here is my question: Can we somehow override existing content catalogs after loading the new one manually?

    PS. Addressables 1.16.7, Unity 2019.4.8f1
     
    Last edited: Nov 6, 2020
  2. Pe1man

    Pe1man

    Joined:
    Jan 10, 2016
    Posts:
    18
    Well, the code below kinda does the trick. Not sure if that's a valid way to make things done, but it works.
    Code (CSharp):
    1. var catalog = await Addressables.LoadContentCatalogAsync(catalogLocation).Task;
    2.  
    3. if (catalog != null)
    4. {
    5.     Addressables.ClearResourceLocators();
    6.     Addressables.AddResourceLocator(catalog);
    7. }