using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; public class TMPTextFont : MonoBehaviour { public TMP_FontAsset fontAsset; public TMP_Text text; void Start() { WeChatWASM.WX.InitSDK((ret) => { // fallbackFont作为旧版本微信或者无法获得系统字体文件时的备选CDN URL // 「注意」需要替换成游戏真实的字体URL!! var fallbackFont = Application.streamingAssetsPath + "/Fonts/AlibabaPuHuiTi-2-55-Regular.ttf"; WeChatWASM.WX.GetWXFont( fallbackFont, (font) => { fontAsset = TMP_FontAsset.CreateFontAsset(font); text.font=fontAsset; } ); } ); } }