以下の内容はhttps://baba-s.hatenablog.com/entry/2022/06/03/090000_1より取得しました。


【Unity】TextMesh Pro 3.2.0-pre.3 以降でダイナミックフォントをリセットする方法

概要

TextMesh Pro 3.2.0-pre.3 以降で Font Asset の Inspector で右クリックして
「Clear Dynamic Data」を押すと

ダイナミックフォントをリセットできます

using System.Reflection;
using TMPro;
using UnityEditor;

public static class Example
{
    [MenuItem( "Tools/Hoge" )]
    private static void Hoge()
    {
        var fontAsset = ( TMP_FontAsset ) Selection.activeObject;
        var type      = typeof( TMP_FontAsset );

        var methodInfo = type.GetMethod
        (
            name: "ClearCharacterAndGlyphTablesInternal",
            bindingAttr: BindingFlags.Instance | BindingFlags.NonPublic
        );

        methodInfo.Invoke( fontAsset, new object[0] );

        TMPro_EventManager.ON_FONT_PROPERTY_CHANGED( true, fontAsset );
    }
}

独自のエディタ拡張から実行したい場合は上記のようなコードを記述します




以上の内容はhttps://baba-s.hatenablog.com/entry/2022/06/03/090000_1より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14