赞
踩
using System;
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
public class UnityUIEvent
{
private static Font font;
[InitializeOnLoadMethod]
private static void Init()
{
if (font == null)
{
font = AssetDatabase.LoadAssetAtPath("Assets/Resources/Font/Alibaba_PuHuiTi.ttf", typeof(Font)) as Font;
}
EditorApplication.hierarchyChanged += delegate ()
{
ChangeDefaultFont();
};
}
private static void ChangeDefaultFont()
{
if (Selection.activeGameObject != null)
{
if (Selection.activeGameObject != null)
{
Text text = Selection.activeGameObject.GetComponent<Text>();
if (text != null && text.font != null && text.font.name == "Arial")
{
text.font = font;
text.fontSize = 21;
}
}
}
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。