Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Building remote catalog for DLC

Discussion in 'Addressables' started by rene-hinterland, Aug 4, 2022.

  1. rene-hinterland

    rene-hinterland

    Joined:
    Mar 18, 2022
    Posts:
    2
    Hello!

    This is a question I've seen a couple of times on here, but I have a confusing situation that isn't answered by any of them. I'm not entirely sure what I'm doing wrong and it's getting really frustrating.

    Some context:
    • Using package version 1.19.19
    • I'm building a base set of addressables that are shipped with the main game. The groups included in the base game are all marked as `includeInBuild` and built as a step during the player build
    • Seperately, I'm building a remote catalog of addressables to be loaded as DLC. Only the groups needed for the DLC are marked as `includeInBuild` and they are built in a separate folder
    When loading the remote catalog (using `LoadContentCatalogAsync`), the assets seem to be added correctly. We can load into DLC scenes as expected, but any objects that exist in the base game are now null.
    For example: an object in the DLC scene references a ScriptableObject that is part of the main game addressables will lose the reference.

    I've tried a couple of things to fix this, but none have worked nicely yet:
    1. Build "dependency" addressable groups when building DLC. This adds a duplicate set of locations when loading the remote catalog, which is not ideal (but can be dealt with)
    2. Building the main addressable groups before building the DLC groups, so the main groups exist in cache.
    3. Looked into making a custom DataBuilder that could handle the dependencies properly. It feels like a very daunting task full of `internal` methods that stop your progress.
    I feel like what I'm doing should work and that I'm missing something obvious about the build pipeline. Hoping someone here can help me out!
     
  2. rene-hinterland

    rene-hinterland

    Joined:
    Mar 18, 2022
    Posts:
    2
    Was hoping someone had a solution to this. Maybe someone from Unity knows what I'm talking about?
     
  3. better_walk_away

    better_walk_away

    Joined:
    Jul 12, 2016
    Posts:
    291
    If you load two catalogs into Addressables, when loading a bundle, Addressables will loop through all catalogs to find the key to that bundle. If the main catalog contains that key, Addressables should find it and load it in. So you might have to set some break points in the Addressables' source code to see what goes wrong.
     
    Last edited: Aug 18, 2022
  4. pillakirsten

    pillakirsten

    Unity Technologies

    Joined:
    May 22, 2019
    Posts:
    346
    Hi @rene-hinterland are you performing both builds within the same project? Disabling the `includeInBuild` checkbox essentially means "ignore this group and don't create any bundles for it". If you're performing both builds within the same project, then your second build that creates your DLC is overwriting your previous build. Any assets referenced by your addressable DLC scenes will be included in the DLC bundles, and so the DLC scenes will load correctly as expected.

    Unfortunately the default built script only builds one local main catalog (and remote catalog if enabled) at a time. It might be possible to build DLC content as a separate catalog, using a custom build script. Though like you said, a lot of the catalog creation code is internal.

    Another approach is to do a regular build for your main game content, and then a content update build for your remote content. Your DLC content will be in a separate catalog, but will require some additional file management when you create new builds. Also note that content update is not supported for platforms that provide their own patching systems (such as Switch or Steam) or that do not support remote content distribution.
    https://docs.unity3d.com/Packages/com.unity.addressables@1.20/manual/ContentUpdateWorkflow.html

    Is there a reason why you'd want your DLC to be in a separate catalog? If it's within the same catalog as your main content, I think the main issue would be having a larger catalog file shipped with your game. Only download the DLC bundles as desired.