I am translating a game into Simplified Chinese. Characters in scripts and unity objects display just fine in the PC-built. However, the WebGL-built would not display correctly (They are ignored—no space or random texts).
I did some digging, and it appears WebGL does not have access to the font in OS as the pc-built does.
To fix that, I import a font that supports simplified Chinese into the assets folder. For unity objects, I can change the default font (Arial) to the font (Microsoft YaHei) I imported.
However, for the characters in scripts, the documentation (Unity - Manual: Font) says you need to save the C# code in UTF-16 encoding for Unicode support. I did that, but the codes will not compile. I think this is not the issue cause the pc-built works just fine.
From my searches in the unity forum, it appears there is an order of fallback fonts unity uses. I chose Microsoft YaHei because it is on that list. Yet, the WebGL-built will not display correctly even I had the TTF file imported and try different settings. Change the font property like “character” from dynamic to Unicode or ASCII.
I also manually defined the fallback order by importing both Arial and MS-YaHei. It still does nothing.
Here are some posts in the forum regarding similar issues.
Any feedback or suggestions are welcomed! Thank you.