今天突然来个替换字体需求,其实不难,但是有些编写函数忘记了=。=
直接贴代码:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEngine.UI;
public class FontToolEditor : EditorWindow
{
private const string MENU_MAIN_WINDOW = "Tools/Font替换";
static Font defaultFont_1 = new Font("FZCuYuan");
static Font defaultFont_2 = new Font("Arial");
static Font toFont = AssetDatabase.LoadAssetAtPath<Font>("Assets/Font/UTMCafeta.ttf");
[MenuItem(MENU_MAIN_WINDOW)]
private static void Init()
{
List<GameObject> prefabs = new List<GameObject>();
&

这篇博客介绍了一个在Unity3D中批量替换游戏对象上Text组件字体的EditorWindow工具。通过遍历Prefab资源,查找并更新所有Text组件的字体,实现了从默认字体到指定字体的转换,简化了字体替换工作流程。
最低0.47元/天 解锁文章
1854

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



