https://docs.unity3d.com/ScriptReference/TrueTypeFontImporter.html

 

Unity - Scripting API: TrueTypeFontImporter

Success! Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable. Close

docs.unity3d.com

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

#if UNITY_EDITOR
using UnityEditor;
public class FontIncludeTester : MonoBehaviour
{
    public Font font;

    public void Do()
    {    	
        var _path    = AssetDatabase.GetAssetPath(font);
        var _impoter = AssetImporter.GetAtPath(_path) as TrueTypeFontImporter;

        if (null == _impoter) return;

        _impoter.includeFontData = !_impoter.includeFontData;
        _impoter.SaveAndReimport();
    }
	
    // 버튼 생성 에디터 코드
    [CustomEditor(typeof(FontIncludeTester))]
    public class FontIncludeTesterEditor : Editor
    {
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            if (true == GUILayout.Button("테스트"))
            {
                (target as FontIncludeTester).Do();
            }
        }
    }
}
#endif

+ Recent posts