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

Question Using LoadContentCatalogAsync with CCD buckets?

Discussion in 'Unity Cloud Content Delivery' started by LucasHehir, Jan 17, 2023.

  1. LucasHehir

    LucasHehir

    Joined:
    May 7, 2020
    Posts:
    74
    I feel like I'm very close to getting my desired remote content setup working, but it's probably better to simply describe the plan rather than my specific trouble spot first.

    What I'd like to achieve:

    I know it's possible to have a 'main' project add remote Addressable catalogs from multiple 'content projects' by using LoadContentCatalogAsync; I want to do this by hosting the bundles from each content project on CCD. I've never done it before but it's supposedly been possible for years now. The plan is to have a minimal main project use Remote Config at startup to fetch a list of remote catalog URLs for LoadContentCatalogAsync to fetch. However, for simplicity sake, I'm just using one debug URL at the moment.

    I've got a separate content project with the sole job of building out an Addressable scene asset, complete with dummy cube. Remote catalog building is enabled and I've set the RemoteLoadPath for this project to point to a CCD bucket release (not sure if this is necessary...). That builds out as cube_all.bundle nicely, so I upload the bundle and catalog and hash to the CCD bucket.

    Ideally, this 'main' project would be able to pull remote scenes like this from potentially many different CCD buckets without any knowledge of each other. This is possible, right?

    The problem I'm having in my attempt:

    Now for my specific issue, I fetch the remote catalog using LoadContentCatalogAsync and that works great. I can query Addressables for ResourceLocations at that point and it does find this Cube.unity scene. If I ask it what the download size is with GetDownloadSizeAsync, it correctly answers the byte amount, looking good. But when I go to actually download using DownloadDependenciesAsync, I get the following:

    UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=Assets/Scenes/Cube.unity, Type=System.Object


    If I go to actually load via LoadSceneAsync, I get a whole bunch of errors:

    Unable to open archive file: Library/com.unity.addressables/aa/OSX/StandaloneOSX/af0ec3231eaf1c31deb12038dda80b64_unitybuiltinshaders_3dd91f4109fbd8368fc8155e49d57676.bundle


    Failed to read data for the AssetBundle 'af0ec3231eaf1c31deb12038dda80b64_unitybuiltinshaders_3dd91f4109fbd8368fc8155e49d57676.bundle'.


    RemoteProviderException : Invalid path in AssetBundleProvider: 'Library/com.unity.addressables/aa/OSX/StandaloneOSX/af0ec3231eaf1c31deb12038dda80b64_unitybuiltinshaders_3dd91f4109fbd8368fc8155e49d57676.bundle'.


    Both the main project and content project are using Unity 2022.1.23f1, Addressables 1.20.5, CCDM 2.1.0.

    Any idea how close I am to achieving the setup? It feels very close so it's correctly ingesting the remote catalog and can poll the scene bundle sizes... it just seems to be tripping over the bundle containing Unity's default shaders, but that doesn't appear in the bundle build location (it appears elsewhere) and uploading it anyway makes no difference.
     
  2. LucasHehir

    LucasHehir

    Joined:
    May 7, 2020
    Posts:
    74
    Oh, interesting revelation.

    If I copy the unitybuiltinshaders bundle into the Library folder on the main project (which won't possible through Addressables/CCD but just curious if it would work)... Unity will actually start loading the scene but never seems to complete, the scene name appears in the hierarchy panel with (Loading) next to its title. My guess is an internal error that doesn't appear in scope of the console.
     
  3. LucasHehir

    LucasHehir

    Joined:
    May 7, 2020
    Posts:
    74
    So upon closer inspection, it seems that my content project scene bundles have this unitybuiltinshaders as a dependency. But if I make the main project generate its own, the name hash and file size is a bit different so it's not a good replacement.

    There's an ongoing thread of people trying to hack their way around this issue here > https://forum.unity.com/threads/loading-multiple-catalogs-each-using-builtin-shaders.794646/

    But I'm wondering if it's simply the wrong approach or something being misunderstood here, it doesn't sound like the right way to use LoadContentCatalogAsync.
     
  4. LucasHehir

    LucasHehir

    Joined:
    May 7, 2020
    Posts:
    74
    Is it possible to get a quick official thumbs up or thumbs down on whether remote catalog scenes are possible? I really need to know if it's worth pursuing for the business year.
     
  5. RobCUnity

    RobCUnity

    Unity Technologies

    Joined:
    Aug 17, 2022
    Posts:
    2
    I am not sure if this will help you or not but in my investigation into creating a separate content application I came across this https://docs.unity3d.com/Packages/c....21/manual/common-workflows/MultiProject.html and there is a note at the bottom


    Handling Shaders
    Addressables builds a Unity built in shader bundle for each set of Addressables player data that gets built. This means that when multiple AssetBundles are loaded that were built in secondary projects, there could be multiple built in shader bundles loaded at the same time.

    Depending on your specific situation, you may need to utilize the Shader Bundle Naming Prefix on the AddressableAssetSettings object. Each built in shader bundle needs to be named different from others built in your other projects. If they're not named differently you'll get The AssetBundle [bundle] can't be loaded because another AssetBundle with the same files is already loaded. errors.
     
    LucasHehir likes this.
  6. LucasHehir

    LucasHehir

    Joined:
    May 7, 2020
    Posts:
    74
    Thanks, looks very relevant, next time I'm trying out this structure I'll give it a shot!
     
  7. eemerse1

    eemerse1

    Joined:
    Jul 9, 2023
    Posts:
    10
    Did you ever manage to achieve this? I'm trying to implement now and running into trouble!