using UnityEngine; using System.Collections; using TMPro; public class Log : MonoBehaviour { TextMeshProUGUI tmpText; void Awake() { tmpText = GetComponent(); } void Start() { tmpText.text = ""; tmpText.enabled = false; } public void WriteOutLog(string text, float letterDelay = 0.05f) { StartCoroutine(WriteLog(text, letterDelay)); } IEnumerator WriteLog(string text, float letterDelay) { tmpText.text = ""; tmpText.enabled = true; foreach (char letter in text) { tmpText.text += letter; yield return new WaitForSeconds(letterDelay); } tmpText.enabled = false; } }