How To Manage Multiple Asset Bundles Which Are Dependant To Each Other

Hi Everyone.
I have a few question about Asset Bundles. I have grouped my assets by type like Textures, Models, Materials, Prefabs …etc. I want to create Asset Bundles for each group. But these groups are dependant to each other. (Models need Materials, Materials need Textures …etc) And I don’t know how to handle them.
How can i Load them so i can just Instantiate a Prefab without having any dependency issues?

Another question is about Scenes. I have a Scenes folder which has all .scene files.
Will making this folder an Asset Bundle pack all sub items into bundle file automatically?

Shortly, I want to manage my Asset Bundles in more advanced ways so i need more information or examples. If you know a tutorial, blog post …etc about multiple Asset Bundle management, please share the links.

Note: I won’t use Adressables for some personal reasons.

Hence why the recommendation is exactly NOT to do what you did. :wink:

You bundle together what belongs together. Say you have one level where at the end you have a boss, and you only want to load that bundle when the boss appears (perhaps it might not appear, perhaps you unload all previous content for that stage.)

Hence you create a bundle for the boss’ meshes, textures, materials, prefabs, audio, and so on.

That’s when you use Addressables. I’m sure you can get over “personal reasons” when it comes to picking the right technology for the job.

Thank you for your answer.
So you suggest me not to bundle assets by their types.
But i would really like to pack them by type for easy game updates. For example, if i pack all textures in a single file, i can offer a HD Texture pack update easily in the future. I wouldn’t have to update all game but just the textures bundle. It is not so important my current game project. I can pack them by scene.
But the reason i want to use Asset Bundles instead of Addressables is that so i can have control of my file encryption. I want to encypt my asset bundles so noone will mode my game.
If there is way to add custom encrytion to Addressables, i can get over my personal reasons to use it :wink:

This will be futile since the decryption code will be in your executable. Right? So it just takes one hacker with a little more expertise and they’ll write a decrypt tool for everyone else to use. More so, if you use standard .NET encryption methods.

I’m not sure why AB would enable that but Addressables wouldn’t. In the end, they are just a single file, and you can encrypt that if you really have to.

That makes some sense but you’ll also have to include the HD materials and then update the renderers at runtime, or replace the textures of existing materials to use the HD variant texture at runtime. Addressables make it possible, at least easier, to create bundle variants so that you can pull the SD variant from the app itself and the HD variants from the cloud.

The problem with bundling all textures together has another layer of complexity though. Say you happen to have shipped a graffiti texture but then you get to hear that in some countries of the world these symbols are offensive and you want to replace just that texture. In that case you’d have to update the “all textures” bundle and force players to download much more than what would be necessary.

It’s likely still the better option to provide boss-sd and boss-hd bundles for specific agents / features in your game rather than by type.

I use IL2CPP scripting backend so none can see inside my methods. Don’t worry about that part :wink:

Check that link. It’s an old but valid example of asset bundle encryption.

It is a complex task. This is why i have asked for advanced examples here. And you are clearly have no answers for any of my questions :slightly_smiling_face:

I said i won’t use Addressables. I would use it if it suits my needs.
And I didn’t want to explain my reasons not to use it in my question. Because, everyone gets weird when they hear about Security like it is not possible in Unity games.

So I am still looking for advanced examples, tutorials, (maybe free assets) …etc.
If anyone knows any, please share with me :+1:

A hacker with knowledge of assembly can still analyze your code. :wink:

That doesn’t sound like it’s tied to the form of bundle, pretty sure you can have that encrypted TextAsset in an Addressable as well.

Well, you don’t want to hear this, but the kind of “security” you ask for just does not exist in general if the decryption happens on the user’s device.

I am still looking for advanced examples, tutorials, (maybe free assets) …etc.
If anyone knows any or has any real answers (not irrelevant nonsense) to my original question, please share with me :+1:

You can look into BuildPipeline.BuildAssetBundles.

You can pass an array of assetbundles and they will automatically have the correct dependencies between them.

  • If you list an asset in assetbundle A and it is used by another asset in a different assetbundle B it will automatically depend on A.
  • If you don’t list an asset in any assetbundle but another asset depends on it it will automatically be added to these assetbundles (and possibly duplicated).
  • One of the files created by this method will also list dependencies between bundles which you can use to figure out the loading order.
1 Like

Here are some good informations about AssetBundle Dependencies.
Also there are some example codes in the article which are not so advanced but it is a nice point to start with.

And here are some more information about How AssetBundles work in deep.

Please share if you find anything else :+1:

Thanks for the good informations :+1: