how to display xml output in unity .i have xml document and don’t know how display that hello world in unity.by reading xml file and displaying in unity using c#
using System.Collections;
using UnityEngine;
public class Test : MonoBehaviour {
private string _url = "http://www.w3schools.com/xml/note.xml";
private string _xml;
IEnumerator Start() {
// Start a download of the given URL
WWW www = new WWW(_url);
// Wait for download to complete
yield return www;
// get text
_xml = www.text;
// having XML here. Do with it whatever you want...
}
// ... for instance, use OnGUI to render it as a label:
void OnGUI() {
if (null != _xml)
GUI.Box(new Rect(10, 10, 400, 300), _xml);
if (else)
GUI.Label(new Rect(10, 10, 200, 30), "Loading...");
}
}
attach this script to a game object
The script is using coroutines to hold the actual rendering until the XML is loaded
You should put using System.Collections; on top of the file. You should definitelly look for some good C# learning resources to learn about namespaces and using commands!