static void ReplaceFont() { List <string> files = new List <string>(); GTTools.GetDirs(Application.dataPath + "/Resources/Guis", ref files); string replacePath = Application.dataPath.Replace("//Assets", string.Empty); List <UnityEngine.Object> objs = new List <UnityEngine.Object>(); for (int i = 0; i < files.Count; i++) { if (!files[i].EndsWith(".prefab")) { continue; } string s = "Assets" + files[i].Replace(replacePath, string.Empty); UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath <UnityEngine.Object>(s); if (obj != null) { objs.Add(obj); } } Font font = AssetDatabase.LoadAssetAtPath <Font>("Assets/Resources/Fonts/Droid Sans.ttf"); NGUIText.dynamicFont = font; NGUISettings.ambigiousFont = font; for (int i = 0; i < objs.Count; i++) { UnityEngine.GameObject go = (GameObject)objs[i]; if (go == null) { return; } GameObject clone = GameObject.Instantiate(go); UILabel[] labels = clone.GetComponentsInChildren <UILabel>(true); foreach (var current in labels) { current.ambigiousFont = font; current.trueTypeFont = font; } PrefabUtility.ReplacePrefab(clone, go); GameObject.DestroyImmediate(clone); } AssetDatabase.Refresh(); AssetDatabase.SaveAssets(); }