Font asset loading/unloading question

More
4 years 9 months ago #3834 by topspin
Hi Devs, great job on this amazing tool! It really saved us indie devs a ton of time!

Here is my question, since each language may have multiple TextMeshPro Font terms and is evolved with multiple font assets and each with their own fallbacks, how do we make sure that only the font assets being used by the current language is loaded into memory?

Korean and Chinese font assets may consume a few MB of rams.

Please Log in or Create an account to join the conversation.

More
4 years 9 months ago #3856 by Frank
The easiest way is to move those fonts to the Resources folder.
That way, the plugin will not keep a reference to them, instead it will just store the font name and whenever the language is loaded, it will load that font if any label is using it.

When fonts are not included in the Resources folder, then the only way of loading them, is by keeping a reference to the font which has an overhead.

The other approach is to use AssetBundles, and then create an AssetBundleManager to load the font from there, the same way as it does for the Resources folder.

More info about the asset loading can be found here:
inter-illusion.com/assets/I2LocalizationManual/AssetsTab.html


Also, note that if you had everything outside of Resources folder and then you move the fonts to there, the plugin will still have the reference in the Assets tab or the "references" section. After you move the font to the Resources folder, you need to manually go to the Assets tab and remove the references.

Hope that helps,
Frank

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out

Please Log in or Create an account to join the conversation.

More
4 years 9 months ago #3859 by topspin
Thanks for replying. We do not use Resource folder as it's not recommended by Unity and it does not support mobile devices. We use Addressable now which is a wrapper around assetbundle. I'll look into it to see if it correctly unload the font asset when switching language

Please Log in or Create an account to join the conversation.

Time to create page: 0.134 seconds
Template by JoomlaShine