Bundle dependencies should be the dependencies one layer deep, the expanded dependencies should just be the rest of the dependency tree in a flattened list.
So if A depends on B, C and C depends on D, E, F then Dependencies for A would just be B, C but the Expanded Dependencies for A would include D, E, F.
Is this a bug or is my assumption wrong and I didn’t understand what you were saying? I’ve attached my test project in case you want to take a look at it.
Maybe he meant transitive dependencies on an asset level, not on a bundle level? Trying maybe having some explicit entry in Bundle A reference an implicit entry in Bundle B (asset not directly added to group).
Thanks for your reply. This lead me to do more trial&error.
I found what seems to cause something to become an “expanded dependency”. It’s complicated to describe, but let me try.
Prefab setup:
Prefab_A has a hard-reference to Prefab_B
Unused_A has a hard-reference to Sprite_A
Unused_B has a hard-reference to Sprite_B
Bundles:
Bundle_A contains Prefab_A and Unused_A
Bundle_B contains Prefab_B and Unused_B
Bundle_Sprite_A contains Sprite_A
Bundle_Sprite_B contains Sprite_B
The prefabs Unused_A and Unused_B are not referenced, but they are stored in a bundle that contains an asset that is referenced and thus pull in an “expanded dependency” to their assets stored in another bundle.
It seems the “expanded dependencies” list represents bundles whose assets are not referenced by the entire dependency chain of any explicit asset in the bundle, but are pulled in because they are dependencies of non-referenced assets in the same bundle.
However, this behavior is not what @davidla_unity described in my opinion.
Based on what I see in buildlayout of my project, it looks to be fairly accurate. I’ll try to put it this way:
If any of the explicit or implicit entries in the Bundle A have hard references to entries in Bundle B, then Bundle B is a “direct” bundle dependency.
If, in turn, Bundle B has a direct bundle dependency to Bundle C, but Bundle A is not dependent on Bundle C directly, then Bundle C will be an “Expanded” bundle dependency on Bundle A.
This explains your first experiment. Because you had a long chain of hard references between your prefabs, to load the Prefab A in memory you need to load all other bundles, because they have required asset-level dependencies. However in the second example, to load Prefab A you only need Bundle B (which contains Prefab B), but you don’t need Unused A/B. So there is no direct bundle dependency. But if you were to load Unused B by it’s address, Unity will require both Bundle B and Bundle_Sprite_B to be loaded in order to do that. So it makes sense to load both direct and expanded dependencies before you can load anything.
So in the end I think @davidla_unity description was accurate. If you first calculate direct dependencies between bundles based on asset dependency graph, and then consider the result on a bundle-level, it all makes sense. Expanded dependencies are transitive dependencies on bundle-level, not asset-level.
I have way too many expanded dependencies for my bundles. If the theory is right, I should end up with the same list of bundles as the expanded dependencies by walking through the direct dependencies and noting down every bundle I encounter. But that list is much smaller (like, 5 bundles instead of 200) than the expanded dependencies suggest.