loading another project's catalog

I have created two Unity projects. A CLIENT project, and a CONTENT project. My goal is to be able to author content in the CONTENT project, and then consume that content from my CLIENT application.

In my CLIENT project, I’ve defined a Local addressable group, as well as a Remote group (which I’m accessing through http://localhost, served up via XAMPP). Then I do a build->new build->default build script, and copy the resulting files into the web folder. So far, all is good. I can LoadAssetAsync, no problems.

In my CONTENT project, I set the groups up identically to the client. Then I do a build->new build->default build script, and copy the resulting files into the web folder, right on top of the ones already there from the client.

When I request an asset that was authored in my CONTENT project, the CLIENT doesn’t see or load it.

How do I get my CLIENT to look at and consume the catalog and assets that were generated by the CONTENT project, and then placed in the same location?

You need to load content in via a Catalog. So you use LoadContentCatalogAsync. All of the files are hashed and such, so I’m fairly certain you can’t just overwrite them, they won’t have the correct hash. You should post your errors here when you attempt to load, would be clearer what’s going on.

Not getting any errors with my original approach. Just no assets.

I will give a longer look at LoadContentCatalogAsync and see what I can see. Thanks for the tip!

I am working on a project with a large amount of content which we will eventually need to migrate to a similar multi-project approach. I’d love to hear back from you if/how you got it all to work.

After some testing, I’m not sure that LoadContentCatalogAsync is what I need here. It needs a PATH argument, and when I put in, i.e. “http://localhost/mystuff/StandaloneWindows64/”, it comes back with Status “Failed”, even if that URL works fine in my browser, and shows the asset files that I want.

Is LoadContentCatalogAsync only useful for LOCAL hard drive resources, and not web URLs?

Perhaps I need LoadResourceLocationsAsync instead? I will do some testing on this.

I’m using LoadResourceLocationsAsync and the client is again only finding its own (remote) catalog, and ignoring the other catalog and assets created by the CONTENT project. There must be a way to either have the client consume all the different catalogs present, or maybe there’s something I need to do to merge the catalogs somehow?

As an experiment, I copied the Assets/AddressableAssetsData/Windows/addressables_content_state.bin from the CLIENT project into the CONTENT project, and then did Build->Update a previous build from within the CONTENT project. Then I ran the CLIENT app again and it was able to see the CONTENT content, but not the CLIENT content. So apparently the build simply replaced the catalog info that was there. I guess this is progress, so yay? But I still don’t know how to build and deploy new content without overwriting any content created in a different project.

Need a way to merge catalogs. Or tell the client to consume catalogs from multiple addressables_content_state.bin.

What was the error?

ChainOperation of Type: UnityEngine.AddressableAssets.ResourceLocators.IResourceLocator failed because dependent operation failed
Failed to load content catalog.
UnityEngine.Debug:Log(Object)
<>c:<LoadCatalog>b__3_1(AsyncOperationHandle`1) (at Assets/_ASoM/Scripts/LoadAssetsFromRemote.cs:49)
DelegateList`1:Invoke(AsyncOperationHandle`1) (at Library/PackageCache/com.unity.addressables@1.7.5/Runtime/ResourceManager/Util/DelegateList.cs:69)
UnityEngine.ResourceManagement.ResourceManager:Update(Single)
MonoBehaviourCallbackHooks:Update() (at Library/PackageCache/com.unity.addressables@1.7.5/Runtime/ResourceManager/Util/MonoBehaviourCallbackHooks.cs:19)```

Are you suggesting that LoadContentCatalogAsync can be used for remote catalogs via http?

That error doesn’t seem very useful. Did you not have other error logs? I usually see 3 or 4 errors when I have an issue, and one of them is the real error.

I haven’t tried it myself, but I believe that should be the case. I’ve seen other people do it that way.

Nope. This is a small test project. Even that error was a Debug.Log that I put in just to see the AsyncOperationHandle.OperationException returned by LoadContentCatalogAsync. There are literally no errors.

Regarding LoadContentCatalogAsync, I am getting no errors (same exception output as above) even if I put in a bogus URL string. i.e. my “real” string should be http://localhost/ASoM/StandaloneWindows64/, but I get the same output if I change it to http://localhost0/ASoM/StandaloneWindows64/, although it does take a second for the localhost0 to timeout. But still, no errors other than the exception as above.

So apparently LoadContentCatalogAsync fails silently and doesn’t offer any help to diagnose the problem. Perhaps this is something that could be improved in a future release?

Okay, apart from LoadContentCatalogAsync failing silently, I may have discovered the real reason why it’s actually failing. I didn’t realize I need the name of the json file as well, and not just the folder that it’s in. So, like this: “http://localhost/ASoM/StandaloneWindows64/catalog_2020.04.16.15.34.47.json”.

So if I need to put the unique identifier into my application code, how will that work in the real world, when I’m doing content updates? Is that catalog name never going to change? Obviously, I wouldn’t want to have to send a whole new application EXE if the content address changes.

You might need to enable Log Runtime Exceptions in your addressable settings.

You could have your server send you the path to the new catalog. Or you can update existing without re-building everything.

I did already have that set during testing. Didn’t say anything.

How would I have my server send the catalog path? So far I’ve been looking at this from the client side.

Hi @Arcanor , were you ever able to get it running? I am working on a similar client/content model right now and I am stuck at a very similar point in time. I can successfully load all my catalogs with

AsyncOperationHandle handle = Addressables.LoadContentCatalogAsync(path to json)

and the handle.Result contains the correct keys. But I am wondering, what happens NOW? Will the addressables do their magic now automatically? Or do I need to put the result somewhere and merge it into a central catalog? @unity_bill can you shed some light here? Would be highly appreciated. In my use case, I have 4 remote catalogs and want them all being accessible in one application.

And yes, I’d also want to have stable names for the json files. What I will most likely do is have a post-processor that renames the files before uploading.

Take a look at my thread for a detailed solution: https://discussions.unity.com/t/777653

Now that all keys are stored in the stack you can use LoadResourceLocation() and then load your content with LoadSceneAsync() or LoadAssetAsync().

If you build 4 catalogs and you update those four their names will be stable. Just use “Build->Update a previous Build” and your new catalog files (.json and .hash) will have the same names as before. Just their content changes and new bundle files might be added. So there is no need to change the URL to the catalog file.

Thanks a lot! I also figures it out in the meantime. Calling LoadContentCatalogAsync 4 times is actually enough. Afterwards LoadAssetAsync works as expected. The only issue I am still fighting with is the shaders issue, that others also discribed in the forums, that when multiple bundles refer to the same (e.g. standard) shader, errors are thrown. It would be great if the addressables system could handle such duplications that I can do nothing against (since any user could upload something, unaware of everything else) somehow more gracefully.

Your welcome!

I’m not sure whether I get you right and maybe your problem is another one. But you could try this:

As far as I understood does LoadContentCatalogAsync() just add everything onto some stack which can cause problems. I solved this problem by simply calling ClearResourceLocators() everytime before I load another catalog. But this does of course only work because I don’t need to load more then one catalog at a time.

1 Like

Hi, when you mark your addressables group as can update after release, you can editor it and update build without changing the name of catalogs.

Hi tayfe, sorry bother you after this long time. Nowadays Im working with addressables.
I have a source project, and I want to load several catalogs from other projects.
I goes with this to load the first catalog:

    IEnumerator LoadCatalogCoroutine()
    {
        isCatalogLoaded = false;
        AsyncOperationHandle<IResourceLocator>  CatalogHandle = Addressables.LoadContentCatalogAsync(catalogPath,true);
        yield return CatalogHandle;

    }

it goes well and I can load assets from it.

But when I change the catalog path to my second catalog path, and recall this function again, I got error:

Exception: Attempting to use an invalid operation handle

How? It really so litte resources on the web of addressables.
Thank you again.