using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class ErrorPopup : MonoBehaviour { public GameObject PopupPrefab; void Awake() { Application.logMessageReceived += OnLogMessageRecevied; } void OnDestroy() { Application.logMessageReceived -= OnLogMessageRecevied; } private void OnLogMessageRecevied(string logString, string stackTrace, LogType type) { StartCoroutine(Popup(logString)); } IEnumerator Popup(string text) { yield return null; var go = Instantiate(PopupPrefab) as GameObject; go.GetComponent().SetParent(GetComponent()); go.GetComponent().SetAsFirstSibling(); var txt = go.GetComponentInChildren(); txt.text = string.Format("[{0}] {1}", DateTime.Now.ToString(), text); var btn = go.GetComponentInChildren