https://docs.unity3d.com/ScriptReference/TrueTypeFontImporter.html
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
'메모' 카테고리의 다른 글
[Unity] Adaptive Performance (0) | 2022.02.17 |
---|---|
[Unity] 온디맨드 렌더링 (0) | 2022.02.17 |
[Unity] AssetBundle & Addressable 폰트 중복 로드 문제 (0) | 2022.01.28 |
[Objective-C] UIImagePickerController 권한 (0) | 2022.01.21 |
[Objective-C] IOS 네이티브 코드에서 Unity 콜백 (0) | 2022.01.21 |