1. Unzip the package and drag the folder to the script folder
Mono is an open source developed by a third-party foundation, and programs developed on a mono basis can be run under individual systems. The development language is C #.
With the plug-in resolution is more efficient, the platform stable operation. Easy to use.
Mono compression package can be found in the Unity installation path
2. New Script Xmltest
Using Unityengine;
Using System.Collections;
Using Mono.xml;
Using System.Security;
public class Xmltest:monobehaviour {
Test whether XML is available
Use this for initialization
void Start () {
Loading an external XML document
String strxml = Resources.load ("Enemy"). ToString ();
Parse the XML, generate the Securityparser object, and parse the string into XML format
Securityparser parse = new Securityparser ();
Pass in the string to parse
Parse. LOADXML (strxml);
Gets the root node of the load XML
SecurityElement SE = parse. TOXML ();
Traverse se Sub-node, SE stands for root, child node represents table
foreach (securityelement element in SE. Children)
{
Determine if the node is a table first
if (element. Tag.equals ("table"))
{
Output All wave property values
Debug.Log (element. Attribute ("Wave"). ToString ());
Debug.Log (element. Attribute ("level"). ToString ());
}
}
}
Update is called once per frame
void Update () {
}
}
3. Create a new manager empty object in scene, hang the script on it, and run it.
Look at the console output, and if the output is the value of the variable in the XML file, the parse succeeds.
parsing XML files with the Mono plugin in Unity