- Home /
How to prevent large font from increasing build size and load time of WebGL by 100%
I'm trying to localize my WebGL game. I need to use a font that covers most/all languages (including Chinese). I cannot use the user's local system fonts, as that is not supported in Unity-WebGL. Currently I'm including "DroidSansFallback.tff" in the build, which has a huge filesize of 2.9MB (The smallest font I could find which covers the Unicode Basic Multilingual Plane). The font doubles the size of my build, and has a huge load-time impact for my game on some browsers.
I need to solve this problem.
I've considered downloading the font externally and in parallel with the Unity build, to help speed up the process. But unfortunately, I can't put a ".tff" file in an asset bundle ("Unrecognized assets cannot be included"). I can get the font directly using WWW, but I can't find a way to turn a byte array representing a font into a UnityEngine.Font object.
How can I prevent a large font from increasing the build size and load time of by WebGL game by 100%?