Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Multiple Catalogs for Platforms

Discussion in 'Unity Cloud Content Delivery' started by jctalespin, Jan 27, 2021.

  1. jctalespin

    jctalespin

    Joined:
    Oct 25, 2018
    Posts:
    9
    Trying to clarify my understanding of Addressable catalogs and how it's handled when building to multiple platforms.

    Normally a catalog for each specific platform is added to StreamingAddressable folder when making builds for a target platform. So this build process prevents an app from including catalogs from other platforms.

    In our project, our catalogs are included in our build and we download both the catalogs and the addressable assets at runtime.

    If the app was built for Android, what would happen if we downloaded two catalogs for (iOS, and Android)? Will the Addressable system will unload iOS addressable assets if the iOS catalog was loaded before the Android catalog using Addressables.LoadContentCatalogAsync? Just wanted to clarify whether if the Addressable system would know which catalog to load from depending on the platform the catalog was built for. I don't that's the case, and we have to download the appropriate catalog based on the platform.
     
    Last edited: Jan 27, 2021
  2. andymilsom

    andymilsom

    Unity Technologies

    Joined:
    Mar 2, 2016
    Posts:
    294
    No, you will need to only load/download the appropriate catalog based on your platform. With the default Local/Remote Build/Load paths in Addressables. We add the build target to the path to keep this in sync.
    The catalog can be loaded, however you should always make sure to only load the platforms that it was built with. As the distinction between platforms is at the AssetBundle level, and will fail when attempting to load the specific Assets.

    In this scenario, it would load both catalogs. There is no definition for what platform can load the catalog in the catalog itself.

    if you are running on iOS and call
    LoadContentCatalogAsync( "path to iOS catalog" );
    LoadContentCatalogAsync( "path to Android catalog" );

    Where the two catalog have identical Addressable Assets, that were built for their relative platforms.

    If you call LoadAssetAsync( "Ball" ), it will then look through the internal data for the catalogs (ResourceLocators). Starting with the locators added in order, finding it in the iOS catalog. This will tell Addressables how to load "Ball", in this case, it will look for the AssetBundle built and referenced to by the iOS, loading the AssetBundle and then attempting to load the Asset from it.

    If you were to then use LoadAssetsAsync( "Ball" ) then it will search for all instances of the key "Ball". Finding it in both the iOS and Android loaded catalogs. Then when attempting to load the "Ball" AssetBundle from the incorrect platform. It will fail.
     
  3. jctalespin

    jctalespin

    Joined:
    Oct 25, 2018
    Posts:
    9
    Great thanks for the explanation! Its making sense to me now.