using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class LoadTTF : MonoBehaviour
{
public bool useJap;
public TextMeshProUGUI UI_Text;
public TMP_FontAsset chineseAsset;
public TMP_FontAsset japAsset;
// Start is called before the first frame update
void Start()
{
if (useJap)
{
UI_Text.font = japAsset;
UI_Text.text = "ござじずぜぞだぢづでどぱぴぷぺぽばびぶべぼらりるれろやゆよわァィゥヴェォカヵキクケコサシスセソタチツッテト";
}
else
{
UI_Text.font = chineseAsset;
UI_Text.text = "这是中文啊";
}
}
}
TMP_FontAsset
下の図は、公式 github デモで生成された 7 つの言語フォントを示しています。
これは Unity によってシリアル化されたアセット ファイルであり、このファイルはエディターにロードすることも、アセットバンドルにパッケージ化してロードすることもできます。