using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class text : MonoBehaviour
{
public Text dialogo;
public TextAsset textAsset;
private List<string >listFiled = new List<string>();
private int index = 0;
void Start()
{
listFiled.Clear();
var textData= textAsset.text.Split('\n');
foreach (var line in textData)
{
listFiled.Add(line);
}
}
// Update is called once per frame
void Update()
{
if(Input.GetKeyDown(KeyCode.Return))
{
dialogo.text = listFiled[index];
index++;
}
}
}
unity文本对话
于 2023-08-19 07:57:13 首次发布