using System; using UnityEngine; using UnityEngine.UI; public class RefreshGuiText : MonoBehaviour { [HideInInspector] public Text text; public bool toUpper; public bool toUpperInvariant; public bool toLower; public bool checkPlatform; private void OnEnable() { Refresh(); } public void LanguageChanged() { Refresh(); } public void Refresh() { if (!text) { text = GetComponent(); } if (toUpper) { text.text = text.text.ToUpper(); } if (toLower) { text.text = text.text.ToLower(); } if (toUpperInvariant) { text.text = text.text[0].ToString().ToUpper() + text.text.Substring(1); } if (checkPlatform) { string newText = text.text; text.text = newText; LeanTween.delayedCall(1f, (Action)delegate { text.text = newText; }); } } }