Set Font Fallback in runtime without changing TMP_FontAsset asset

We’re trying to implement localization support for CJK, and these are what we’re trying to achieve :

  1. Base Game will contain English/Latin Static Font Asset (Default Language)
  2. Addressable Asset Bundle that contains CJK Static Font Asset that includes all known text in the game (will be downloaded when player switch language)
  3. Base Game will contain CJK Dynamic Font Asset (For handling player inputs, in this case, to display other player’s names)

We’re thinking of setting the Dynamic Font Asset as a fallback for the Static Font Asset, to handle any missed texts, and also not requiring to rebuild that asset bundle with every small update. However, if I set that in the editor, the Dynamic Font Asset (together with the .ttf font file) will be packed into the bundle.

So I tried setting the fallback after the Static Font has loaded. But, this will modify the asset when playing in editor, causing the fallback to be saved.

Is there any other way I can do this?

For me, using an editor-only script to constantly reset the font’s fallbacks (when it’s not playing) does what I need.

using TMPro;
using UnityEditor;
using UnityEngine;

namespace Studio.Game.Editor
{
    [InitializeOnLoad]
    public class TMPSettingsEnforcer
    {
        static TMPSettingsEnforcer ()
        {
            EditorApplication.update += Update;
        }
       
        private static void Update()
        {
            if (Application.isPlaying)
            {
                return;
            }
            TMP_Settings.defaultFontAsset.fallbackFontAssetTable.Clear();
        }
       
    }
}