using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using DG.Tweening; public class PopupMgr { public static PopupMgr _ins; public static PopupMgr ins { get { if (_ins == null) { _ins = new PopupMgr(); } return _ins; } } public void ShowTip(string text) { GameObject o = GameObject.Instantiate(Resources.Load("Prefabs/Popups/PopupCanvas")); Text textComp = o.transform.Find("Tip").GetComponent(); textComp.text = text; GameObject.DontDestroyOnLoad(o); Sequence seq = DOTween.Sequence(); seq.PrependInterval(3); seq.AppendCallback(() => { GameObject.Destroy(o); }); } }