How dependency resolution works in Asset Bundles?

I am really excited about the new improvements to asset bundles as I have been working towards using them for modding for a long time.

My problem at the moment is that all of the tutorials explain their use from the use case of building everything from the same project at the same time.

The workflow I need to use is this:

  • Original game is built, windows standalone with many assets, some exported as a unitypackage SDK
  • Modder downloads sdk and creates new project
  • Modder makes new scene, uses some SDK prefabs, models scripts and textures, adds some of their own
  • Modder exports assetbundle with only new assets contained, sdk assets remain dependencies

So I can then import the bundle into a runtime build of the game that had no knowledge of the bundle at compile time, and have the references to assets that were part of the SDK link to the assets already built into the game (not a duplicate inside the bundle).

So far I have been able to get scripts to resolve to their originals, but I can’t figure out how to get anything else to reference the original assets.

My question is, how does an asset bundle prefab, scene, gameobject, or material reference a dependant asset that isn’t contained in the same bundle.

My assumption was if I ensure the guid inside the meta files for the SDK project and the original project match that they should resolve fine but this isn’t the case.

I know the logic is there to lookup an asset in another bundle / original build as bundles can be dependent on other bundles, but I can’t tell if this linking is something that is done using black box magic at build time. IE, bundles can only have dependent assets if they are built into another bundle at the same time from the same editor.

Could somebody from Unity please clarify how this resolution works internally? Or alternatively suggest a workflow to achieve the scenario described above.

So I’ve managed to get other assets to resolve.

Looks like the only way to do it is to move the SDK files into an asset bundle, built with the main application, and build an exact replica of the SDK assetbundle from the Mod project when building the mod bundle then throw away the one built by the mod project.

The mod asset bundle resolves it dependencies to the original built one thinking it was the one that it was built with and accurately references original assets.

Will post my findings, but looks to be working with prefabs, materials and textures so far :slight_smile:

Insight on the exact science of this from Unity would be much appreciated

Still would love to get some input on this. The rebuild copies of everything to ensure dependencies between bundles in maintained is a very clunky solution

Bump