using UnityEngine;
using System.Collections;
using UnityEditor;
using UnityEngine.UI;
using System.IO;
public class ChangeFont : EditorWindow
{
[MenuItem("Tools/ChangeUIFont")]
public static void Open()
{
EditorWindow.GetWindow(typeof(ChangeFont));
}
public Font toChange;
static Font toChangeFont;
void OnGUI()
{
toChange = (Font)EditorGUILayout.ObjectField(toChange, typeof(Font), true, GUILayout.MinWidth(100f));
toChangeFont = toChange;
if (GUILayout.Button("ChangeUIFont!"))
{
Change();
}
}
public static void Change()
{
Object[] labels = Selection.GetFiltered(typeof(Text), SelectionMode.Deep);
foreach (Object item in labels)
{
Text text = (Text)item;
text.font = toChangeFont;
text.gameObject.SetActive(!text.gameObject.activeSelf);
text.gameObject.SetActive(!text.gameObject.activeSelf);
}
}
}
using System.Collections;
using UnityEditor;
using UnityEngine.UI;
using System.IO;
public class ChangeFont : EditorWindow
{
[MenuItem("Tools/ChangeUIFont")]
public static void Open()
{
EditorWindow.GetWindow(typeof(ChangeFont));
}
public Font toChange;
static Font toChangeFont;
void OnGUI()
{
toChange = (Font)EditorGUILayout.ObjectField(toChange, typeof(Font), true, GUILayout.MinWidth(100f));
toChangeFont = toChange;
if (GUILayout.Button("ChangeUIFont!"))
{
Change();
}
}
public static void Change()
{
Object[] labels = Selection.GetFiltered(typeof(Text), SelectionMode.Deep);
foreach (Object item in labels)
{
Text text = (Text)item;
text.font = toChangeFont;
text.gameObject.SetActive(!text.gameObject.activeSelf);
text.gameObject.SetActive(!text.gameObject.activeSelf);
}
}
}