using System; using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; public class ErrorTip : MonoBehaviour { public TextMeshProUGUI errorMsgText; Action onError; string errorData; public static ErrorTip Instance; private void Awake() { Instance=this; } public void Init(string errorMsg,string data ,Action onError) { if (errorMsg.Length > 1000) errorMsg = errorMsg.Substring(0, 1000); errorMsgText.text = errorMsg; this.onError = onError; errorData = data; } public void ReLink() { if (onError != null) { onError(errorData); onError = null; } Destroy(gameObject); } public void Close() { Destroy(gameObject); } }