要使文字全部显示后将一个组件SetActive的值设置为true,你可以在IEnumerator ShowTextBoxes()方法的最后添加一行代码来实现。

具体修改代码如下:

IEnumerator ShowTextBoxes() { // 逐个显示文本框 foreach (Text textBox in textBoxes) { textBox.gameObject.SetActive(true); // 激活文本框 // 逐个显示字符 string text = textBox.text; textBox.text = string.Empty; foreach (char c in text) { textBox.text += c; yield return new WaitForSeconds(delayBetweenCharacters); }

    yield return new WaitForSeconds(delayBetweenTextBoxes); // 等待一段时间
}

// 当所有文本框都显示完毕后,将一个组件SetActive的值设置为true
// 假设你要设置一个名为"YourComponent"的组件
YourComponent.SetActive(true);
public class TextBoxManager MonoBehaviour public Text textBoxes; 存储多个文本框的数组 public float delayBetweenTextBoxes = 05f; 文本框之间的延迟时间 public float delayBetweenCharacters = 01f; private int c

原文地址: http://www.cveoy.top/t/topic/ivu2 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录