using UnityEngine; using UnityEngine.UI; using DG.Tweening; using System; using System.Collections; public class TextWrite : MonoBehaviour { private Text _text; [SerializeField] float speed=0.15f; private void Start() { _text = GetComponent(); string str = _text.text; _text.text = ""; _text.DOText(str, str.Length * speed, false); } public void ChangeText(string str) { _text.DOText("",0.01f); _text.DOText(str, str.Length * speed, true); } public void ChangeText(string str,Action action) { if (str == "") { _text.transform.parent.gameObject.SetActive(false); PassManager.Instance.StartTimeAction(0, action); return; } _text.DOText("", 0.01f); _text.DOText(str, str.Length * speed, true); float time = str.Length * speed; Debug.Log(time); PassManager.Instance.StartTimeAction( time, action); } }