Created
March 20, 2024 23:52
-
-
Save baba-s/35845e044064e5873694041d8118a4b8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using TMPro; | |
using UnityEngine; | |
public class Example : MonoBehaviour | |
{ | |
[SerializeField] private TMP_FontAsset m_tmpFontAsset; | |
private void Awake() | |
{ | |
TMP_Text.OnFontAssetRequest += OnFontAssetRequest; | |
TMP_FontAsset OnFontAssetRequest( int index, string name ) | |
{ | |
Debug.Log( $"index: {index}" ); | |
Debug.Log( $"name: {name}" ); | |
return name == "azuki SDF" | |
? m_tmpFontAsset | |
: Resources.Load<TMP_FontAsset>( $"{TMP_Settings.defaultFontAssetPath}/{name}" ) | |
; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment