using BitStrap; using UnityEngine; using UnityEngine.UI; public class UpdateFont : MonoBehaviour { public bool onUpdate; public bool onStart; public bool allChildren; public Font font; public GUIManager.FontType fontType; public void Start() { if (onStart) { UpdateFonts(); } } private void Update() { } [Button] public void UpdateFonts() { if (this.font == null && GUIManager.Instance == null) { return; } Font font = ((!this.font) ? GUIManager.Instance.GetFont(fontType) : this.font); if (allChildren) { Text[] componentsInChildren = GetComponentsInChildren(true); Text[] array = componentsInChildren; foreach (Text text in array) { if (!text.GetComponent() || !text.GetComponent().enabled) { text.font = font; } } } else { GetComponent().font = font; if ((bool)GUIManager.Instance && GUIManager.Instance.GetFontToUpper(fontType)) { GetComponent().text = GetComponent().text.ToUpper(); } } } }