Search Unity

Question Why does my bundle has dependencies?

Discussion in 'Asset Bundles' started by Noblauch, Jan 21, 2021.

  1. Noblauch

    Noblauch

    Joined:
    May 23, 2017
    Posts:
    275
    Hi, I have a problem debugging dependency issues, and I hope you can help!

    We are currently using the Addressables System to create our bundles, problem is, that sometimes there appear random dependencies between bundles.
    How do I find out the reason or the asset(s) that causes this?

    I already found one reason, by deleting scenes from the bundle until a unwanted dependency was gone, then going into the scene and deleting every game object until the dependency was gone again.

    It seems like we have a ton of these issues, which only showed up now as we are testing remotely. Of course I can't use this workflow for every issue, this would take forever. There must be a way to figure out what causes the dependencies.

    I found the AssetBundle Browser, and it gives me some kind of hash for dependencies:
    defaultlocalgroup.png

    But I can't make sense of these cab- hash things. And the browser doesn't let me search these as-well. How would one go about this?
     
    ProdiggaPA likes this.
  2. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,821
    I'll flag this with the team. Which version of Addressables are you on?
     
  3. Noblauch

    Noblauch

    Joined:
    May 23, 2017
    Posts:
    275
    @TreyK-47
    We updated to 1.16.15 a week ago. I'm not sure if we are doing it wrong, but yep. These hashes are the only hints that we have, but they don't really help :s
     
    ProdiggaPA likes this.
  4. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    Hey @Noblauch so that AssetBundle Browser tool is fairly dated at this point and hasn't been maintained (to my knowledge) in quite some time. We don't have anything built in that actually shows the AssetBundle dependency tree at the moment. We could add a custom AnalyzeRule for this, or expose the BundleRuleBase to make it easier for you to make your own. Maybe we should do both. I'll add a feature request.

    Sorry I'm not more help than that. If you're ok with bringing the package out of the Library/PackageCache folder and into the Packages folder so you can edit it you could make your own child class of BundleRuleBase and use the write data of the build to construct the dependency tree.
     
  5. Noblauch

    Noblauch

    Joined:
    May 23, 2017
    Posts:
    275
    Hey @davidla_unity thanks for your reply!
    We are currently not really comfortable from removing the Addressables package from its managed environment.
    For now I implemented some post processes for our scenes to make sure everything is cleared out, even if its maybe unnecessary at times, but we managed to keep the inter-dependencies to a minimum now, without really knowing what caused them.

    I've used the package very intensely now for the first time in a real production, and I hope I'll find the time to share some feedback in the future. But we are still struggling with our deployment pipeline, so I'm still hoping that we will find a satisfactory solution for our last roadblocks.
    I'm sure you have quite a ton to do, but keep up improving the system! I'd love to use it in the next project, but the way it works for us now – no front – I'd probably manage the bundles myself to avoid days and weeks of troubleshooting.
    Keep up the good work!
     
    KarimTA likes this.
  6. daxiongmao

    daxiongmao

    Joined:
    Feb 2, 2016
    Posts:
    412
    Something I just ran into with materials and particle systems. Is that unity as a convenience does not remove old values.
    I had particle systems that at one point I set to use a mesh shape for emitting. I later changed to just a cone emitter.
    When finding dependencies using AssetDatabase.FindDependencies this was being listed as a dependency even though it was not selected.

    Similar with materials, if you have set a texture at one point and change shader that no longer uses that texture. It is still captured in the material and causing a dependency.

    You may want to verify you do no have any of these hidden dependencies. They do not show in the editor, you need to go into debug mode to more easily find them.

    It seems addressable has the same issue. It will include these hidden references. I have seen places it uses the same AssetDatabase.FindDependencies to do part of its work.
     
  7. luistorres_emvenci

    luistorres_emvenci

    Joined:
    Aug 23, 2021
    Posts:
    16
    This seems it could fix a issue that i've run into, could you elaborate a bit more on how to remove this "hidden dependencies"?
     
  8. daxiongmao

    daxiongmao

    Joined:
    Feb 2, 2016
    Posts:
    412
    Just the things I mentioned. You need to select materials and switch the inspector to debug. You will see the unused properties that are still assigned to assets like materials and particle systems.

    A lot of unitys inspectors and assets store references to things that are not actively used as a feature when you switch back to it that it is still there. Change shader and the materials are still set, change emittier shape and its still remembers the mesh from before.

    The actual build process handles these better than find dependencies did. I have not tested this more recently to see if anything was changed, but I doubt it has.

    I tried looking into some of the other API supposedly used during the actual build process but they were more complicated and lacking any kind of documentation. So I just use my tools now and if I find things I know should not be referenced I would go and fix them. Deleting the property slots or deleting referenced meshes.

    AssetDatabase.FindDependencies is still a useful tool, because I think it always included to much vs missing things.

    Check this post for more details.
    https://forum.unity.com/threads/hid...pendencies-addressables.1192141/#post-7909273
     
  9. luistorres_emvenci

    luistorres_emvenci

    Joined:
    Aug 23, 2021
    Posts:
    16
    Thanks for the help! Also I figure this tool could also help you in some way:

    I've managed to clean one out of two references, (it had to do with the material texture!). Still having trouble in finding a clear workflow to track this specific asset dependencies all fix them.