Legacy text system and font fallbacks

I am trying to keep up-to-date a game made about a decade ago when the old GUISkin system was the official Unity way of writing a user interface. There is a tremendous amount of logic in these laborious OnGUI functions and it would almost require a complete rewrite to make it all consistent with the more newly recommended UI systems.

The problem is that my app is localized into several languages including Korean, Japanese, and Chinese and prior to updating to the latest version of Unity in 2023 (previous installed version was from 2021) the Android version of the app would fallback to fonts which displayed these oriental characters automatically. Since updating Unity they now simply appear as invisible/blank characters on Android, yet they display fine in the Editor as previously.

After having some difficulty explicitly setting fallback fonts with the following process:

  1. import a .ttf file that handles Korean characters (eg Malgun Gothic)
  2. select our main language fonts in the editor (eg TempsITC.ttf)
  3. in the inspector, add Malgun Gothic to the Font Names list.

Nothing appears to fall back at all. I then came across this thread How to make Fallback Fonts work?? Is this a bug or am I doing it wrong???

Where a user has basically the same issue and is advised to abandon the Legacy text system, which is in my case rather difficult to do. Is anyone please aware of any work around other than reverting to an older version of Unity so that I can keep this old app and Unity updated?

Incidentally importing Malgun Gothic added nearly 20mb to my app, and I imagine the Japanese and Chinese would be similarly sized. Previous iterations which somehow included all the relevant font fallbacks automatically for Android (as they still do in the editor) were only 70mb or so as .apks.

Got a solution in the end if anyone else encounters this bug with font fallbacks no longer working automatically via the GUISkin system on Android.

  1. import Noto Sans CJK font into unity (handles all 3 of the oriental languages).
  2. detect device language
  3. on the condition it is Chinese Japanese or Korean:

cycle through the entire GUISkin and assign each custom style’s font to Noto Sans CJK. You may need to assign IDE pointers to the orientalFont in the editor:

        if (lang == "Korean" || lang == "Japanese" || lang == "Chinese")
        {
            int i = 0;
            while (i < theSkin.customStyles.Length)
            {
                theSkin.customStyles[i].font = orientalFont;
                i++;
            }
        }

If you don’t want to change all of them you can obviously have some if checks for the current font. Added 13mb to the .apk size but at least it works, I imagine my previous build was less stable in the event the user didn’t have some font installed on his OS.
Lets hope this keeps me going for a few more years, please people at Unity don’t deprecate the GUISkin system entirely so we can keep hacking our older apps together for a few more years, people still play them.
Cheers

1 Like