#if UNITY_EDITOR using PMaker.Extension; using Sirenix.OdinInspector; using System.Collections.Generic; using System.Text; using TMPro; using UnityEngine; public class FontHelper : BaseBehaviour { private void Reset() { this.name = ">" + this.GetType().Name; this.gameObject.tag = "EditorOnly"; } public TextMeshProUGUI[] allText; public Dictionary> pool; public TextMeshProUGUI text; [Button] public void Init() { this.allText = Resources.FindObjectsOfTypeAll(); pool = new Dictionary>(); foreach (var item in this.allText) { var font = item.font; if (pool.ContainsKey(font) != true) { pool.Add(font, new List()); } pool[font].Add(item); } this.SetDirty(); } [Button] public void SetText() { var stringBuilder = new StringBuilder(); foreach (var item in allText) { stringBuilder.Append(item.text); } this.text.text = stringBuilder.ToString(); text.SetDirty(); } } #endif