Exclude sharing asset in AssetBundle and Actual build.

Hi. I’m having difficulties with assetbundling. But I don’t know how to approach this kinda problem.

Let’s assume I’m building android application.

I have a font asset, let’s call it “font.ttf” which is 4mb.

In startup scene, scene has UGUI that uses font.ttf. This scene doesn’t get into assetbundle. It will be included in apk.

And I have 100 prefab that uses “font.ttf” and this prefab will be assetbundled separately. So it would be like 100 assetbundle right?

The problem is, According to this article, those 100 assetbundle will include “font.ttf” individually. So every assetbundle will have its own separate “font.ttf”, so redundant 396mb is used just for those fonts.

To avoid such this problem is, making “font.ttf” as an assetbundle, then those other 100 assetbundle will know that the font depend on “font.ttf” assetbundle and not include it.

But the problem is, if I assetbundle the font, when in startup scene which didn’t downloaded the assetbundles at all, UGUI cannot use “font.ttf” so it won’t show any font.

Question is, how do I order BuildPipeline.BuildAssetBundles() to not to include “font.ttf”, and instead just use in the actual build? I saw “BuildAssetBundleOptions.CollectDependencies” is deprecated and became mandatory.

Is it inevitable? Do I have to just have one font for build, and one font for assetbundle?

Bump. Issue persists.
For me it’s materials. I want to change a shared material but the assetbundle has a unique material instead.

Any answer? Ive needed this solved for years now.

Answering my own question after 3 year… I’ve just forgot to leave answer because there were no reply for this kind of situation.

Answer is… There is no way to achieve this.

I’ve solved this problem, just copy the asset one for the Apk, and other for the AssetBundle.

I’ve really looked a lot in AssetBundle related, but assetbundle doesn’t pull dependency which is included in apk build.

It’s just not possible.

Why not just include one asset bundle with your app for shared files like this, and then download the others?