2
\$\begingroup\$

My game uses AssetBundles, and quite often each of those bundles use TextMeshPro. The project is at a stage where it would be unwise to change to Addressables.

Anyway, I noticed that when a bundle has TextMeshPro involved, it easily adds roughly 2mb to the bundle - I assume it's a copy of all the dependencies to make it work.

Ideally all bundles should simply point to one copy which is guaranteed to always be present in the game, which I think Addressables sort of does, but as mentioned we cannot use it for this project for various reasons.

One way is to create/add the TextMeshPro components at runtime (e.g. have some kind of "placeholder/dummy" component that, upon Awake() will add TextMeshPro with various preset attributes).

That would work fine, and I'm willing to do that - but perhaps there are less tedious alternatives (other than Addressables) that I haven't thought of.

The goal is to be able to reduce the disk space required for each bundle just because it is using TextMeshPro components.

\$\endgroup\$
2
\$\begingroup\$

Step one is to determine what is being included in multiple asset bundles that can be included in just one.

https://docs.unity3d.com/Manual/AssetBundles-Browser.html

This tool lets you look at what is included in asset bundles, whether directly assigned or as a dependency of something else. It also indicates with a warning flag anything that is being included in multiple bundles.

Step two is then to just move all of those things into a separate asset bundle, which you can do from right inside that tool. Just select everything that has a warning flag, and drag it over to the section where it lists all asset bundles. It will ask if you want to make one bundle for each asset or one bundle for everything selected. Go with the single bundle option. Then, all of the other asset bundles should now rely on that single dependency asset bundles.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .