通过协程达到UGUI中Text面板字体逐个显示
void Update () {//循环播放文字 if (isGoing) { isGoing = false; StartOne(); } private Text text1;//故事面板文字栏 private string textTemp;//故事面板具体文字 private void StartOne() { text1.text = ""; textTemp = "xxxxxxxx所要显示的文字"; cc = textTemp.ToCharArray();//将string类型里的每一个字转化成char集合 StartCoroutine(TextOne()); } IEnumerator TextOne() { bool isGo = true; while (isGo) { for (int i = 0; i < cc.Length; i++) { yield return new WaitForSeconds(0.15f);//每0.15秒产生一个文字 text1.text += cc[i]; } } }