Caching external content catalog

Hey,

I have two projects, a main player and a content project.
I am building bundles in the content project and loading them in the player project by using: Addressables.LoadContentCatalogAsync(catalogURL); then loading the assets.

This works fine with a connection to the server, but I would like to implement an offline mode where after the bundles are downloaded the first time, you don’t need a connection in the future to load the assets.

Currently it gives an invalid key exception when offline since the catalog isn’t loaded.

Is it possible to cache the external catalog in the addressables system currently, or will I have to manually download the catalog locally and point the url to it when offline?

Thanks.

1 Like

+1 - I’d like to implement exactly the same scenario. Is there a built-in way to do it?

You can add a resource locator directly. Though Addressables.AddResourceLocator()

// Pseudo code, not actual working code

var catalogData = new ContentCatalogData(data)

ResourceLocationMap locMap = catalogData.CreateLocator(providerSuffix);
             
addressables.AddResourceLocator(locMap, catalogData.localHash, catalogData.location);
/// <summary>
/// Add a resource locator.
/// </summary>
/// <param name="locator">The locator object.</param>
/// <param name="localCatalogHash">The hash of the local catalog. This can be null if the catalog cannot be updated.</param>
/// <param name="remoteCatalogLocation">The location of the remote catalog. This can be null if the catalog cannot be updated.</param>
public static void AddResourceLocator(IResourceLocator locator, string localCatalogHash = null, IResourceLocation remoteCatalogLocation = null)
{
    m_Addressables.AddResourceLocator(locator, localCatalogHash, remoteCatalogLocation);
}
1 Like

Awesome, Ill try this out, thanks.

I’m totaly in the same situation.
But I don’t get it to work.

Can you provide me some more code on how to do it?

I’m using Version 1.8.3
Thanks in advance.

2 Likes