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