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. Dismiss Notice

Question How to see if AssetBundle has dependencies to another AssetBundle?

Discussion in 'Addressables' started by Peter77, May 28, 2021.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,438
    I need to see if an AssetBundle has dependencies to other AssetBundle's. Is there a tool for it?

    We have different level themes (for example japan, america, etc) in the game. Each theme is stored in its own bundle. Now I want to ensure the japan bundle does not have a dependency to the america bundle.

    The reason why these themes must be "standalone" is that the player shoulddownload just the relevant data (smallest possible data set) rather than every other "theme bundle" as well, because someone perhaps picked a material from another theme by accident.
     
    Xarbrough likes this.
  2. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    1,184
    Up you go, thread! I have the same question. I'd like to stress that such a tool seems absolutely vital to converting existing projects to using Addressables. I have multiple projects were Addressables weren't part of the beginning and needed to be introduces later during development which meant going through hundreds of assets and creating dozens of bundles. The strategy was usually clear, but in reality, we always had a lot of issues trying to manage dependencies.

    Here's a simple example:
    • Bundle A contains the first level
    • Bundle B contains the second level
    • Bundle C contains shared assets
    • A and B depend on C, so C is always loaded
    • But wait, actually, scene B only needs a single asset from Bundle C, so we to duplicate this one instead or move things around to make better use of memory.
    This last step becomes incredibly difficult when projects are more complex and I believe it would be much easier if the Analyze Window or similar tool could show the connections between assets to bundles and bundles to other bundles.
     
  3. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,795
    I'll flag with the team for some guidance!
     
  4. Unity_Joseph

    Unity_Joseph

    Unity Technologies

    Joined:
    Nov 3, 2016
    Posts:
    16
    Hi,

    You can enable the build layout feature in the Addressables preferences window. That will generate a text file that shows detailed AssetBundle dependencies. Here is a link to the docs: https://docs.unity3d.com/Packages/com.unity.addressables@1.16/manual/DiagnosticTools.html

    If you are building AssetBundles manually using the built-in AssetBundle pipeline (BuildPipeline.BuildAssetBundles), you can use the AssetBundleManifest to determine AssetBundle dependencies: https://docs.unity3d.com/ScriptReference/AssetBundleManifest.html

    @Xarbrough to duplicate the Asset, instead of putting it in a shared AssetBundle, don't assign that Asset to a group. It will then be duplicated in all groups that reference it. Also note that loading a shared AssetBundle will not actually load any objects, the objects are loaded separately through loading APIs. So it's okay to have an AssetBundle that references a large shared AssetBundle for just a single Asset. There are however tradeoffs when selected how granularly you want to break down your AssetBundles. A good bit of information about AssetBundle organization can be found in the Addressables docs . Most of the information is helpful even if you are using AssetBundles directly without Addressables: https://docs.unity3d.com/Packages/com.unity.addressables@1.16/manual/MemoryManagement.html
     
    Xarbrough likes this.