UI中的设置如图所示:
其中Text脚本中的代码如下所示:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System.IO;
public class text:MonoBehaviour
{
public float charsPerSecond=0.2f;//打字间隔的时间
private string words;//保存需要显示的文字
private bool isActive=false;
private float timer;//计时器
private Text myText;
private int currentPos=0;
private AudioSource keyAudio;
private void Start()
{
timer=0<