using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditor.Experimental.GraphView;
/// <summary>
/// UI替换字体
/// </summary>
public class UIFontEditor : EditorWindow
{
private static Font newFont;
private static string uiPrefabsDir = "Assets/RawAssets/UI";
private static int fontSizeOffset = 0;
private static bool isFontSize=false;
private static bool isFontBold=false;
[MenuItem("Tools/UI/UI字体替换")]
public static void CreateWindow()
{
GetWindow<UIFontEditor>("Change UI Font");
}
private void OnGUI()
{
EditorGUI.BeginChangeCheck();
EditorGUILayout.BeginVertical();
EditorGUILayout.LabelField("该工具替换UI预设UILabel字体");
EditorGUILayout.LabelField("默认不改变字体大小和样式");
EditorGUILayout.LabelField("默认 UI Prefabs 路径:",uiPrefabsDir);
EditorGUILayout.Space(10);
uiPrefabsDir = Editor
Change UI Prefabs Font for UnityEditor(NGUI UILabel)
最新推荐文章于 2021-12-15 19:57:12 发布
这个Unity编辑器扩展脚本实现了批量替换UI预制件(Prefab)中的UILabel字体,支持调整字体大小和设置为粗体。用户可以指定新的字体文件、字体大小增量以及是否改变字体样式。工具首先查找指定目录下的所有UIPrefab,然后遍历每个Prefab中的UILabel组件进行替换操作,并保存更改。

最低0.47元/天 解锁文章
1439

被折叠的 条评论
为什么被折叠?



