我需要创建一个 xml 文本文件并通过(使用框)使用脚本在场景中显示此文本?我创建了一个 xml 文本文件,即位于 c 驱动器中。请参阅我的以下代码并使用 C# 帮助我。下面的代码使用 ngui 标签。但是使用框显示很好。
using UnityEngine;
using System.Collections;
using System.Xml;
using System.IO;
public class Xml : MonoBehaviour
{
// Use this for initialization
void Start ()
{
XmlDocument xml=new XmlDocument();
xml.Load(Application.dataPath+"/Resources/text.xml");
}
// Update is called once per frame
void Update () { }
void OnGUI()
{
UILabel subtitle = GameObject.Find("Label").GetComponent();
subtitle.text = "";
}
}