Hey I made a WebGL build of an app I was working on and noticed only English characters work in the Unity UI.
Japanese characters work in the Editor, PC and Android just fine but NOT WebGL.
Is this a bug?
Unity 5.2.0p1.
Windows 10.
Tested in Chrome and Firefox.
What font did you use for the text components?
To make sure that the font that holds the characters is available, include it into the project end reference it.
The default font on windows is Arial for example.
But unity does not include the Arial font file into the build unless you copy the Arial font file into your asset folder and assign it to the text element.
If the Font is not available on your target platform unity will fall back to another font that is available, if that fallback font does not include the characters yo are targeting you get problems.
Thanks for repoting.
I did test your setup as provided and with the areal windows font included into the project and linked to the text component, no change , the special characters are still missing in webgl. My guess would be that the way unity writes the files in webgl does not work for extended character sets.
So, this cannot work on WebGL, for the reason I quoted from the docs.
Arial does not contain Hiragana glyphs. When Unity encounters a glyph which is not present in a font it is using, it will fall back to the OS installed fonts to find one which has the glyph. But, In WebGL, it does not have access to the system ttf files, so it cannot do that. So, for it to work, you need to use a font which either actually contains the glyphs you need, or which has specified a fallback font (which needs to also be included in the project) containing the glyphs.
Do you know what Windows font it falls back to? I understand what you’re saying now. Wish Unity came with a font or fonts that had more characters by default. I’ll do some more tests to confirm.
On windows or OS X, it will try the following fonts as fallbacks:
// Make Arial first fallback for consistency, as it widely available.
gFontFallbacks->push_back("Arial");
// Arial Unicode MS covers almost all unicode scripts, and is available on OS X (>=10.5).
gFontFallbacks->push_back("Arial Unicode MS");
// This should catch Unicode scripts on Windows, excluding Asian scripts
gFontFallbacks->push_back("Microsoft Sans Serif");
// This should catch Chinese on windows
gFontFallbacks->push_back("Microsoft YaHei");
// This should catch Korean on windows
gFontFallbacks->push_back("Gulim");
// This should catch Japanese on windows
gFontFallbacks->push_back("MS Gothic");
Be careful what you wish for The default font shipping with Unity WebGL is intentionally stripped down to a basic latin character set to avoid build size exploding for projects which don’t need this. Arial Unicode, which is pretty complete, is a 23 MB font file (Or still 15 MB compressed). I don’t think that adding that as the default font would help in all those threads about WebGL build size.