Skip to content

Instantly share code, notes, and snippets.

@baba-s
Created March 20, 2024 23:52
Show Gist options
  • Save baba-s/35845e044064e5873694041d8118a4b8 to your computer and use it in GitHub Desktop.
Save baba-s/35845e044064e5873694041d8118a4b8 to your computer and use it in GitHub Desktop.
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