Unity中XML创建及修改,背包物品举例

using UnityEngine;
using System.Collections;
using System.Xml;

public class XmlParse : MonoBehaviour {

    //文件路径
    private string filePath = string.Empty;
    private string fileName="/BagConfig.xml";

    void Start () {
        filePath = Application.streamingAssetsPath + fileName;
    //    AddNode ();
        AddNum (2000,50);
    }
    void AddNode(){
        //创建一个XML文件解析的文件工厂
        XmlDocument doc = new XmlDocument ();
        doc.Load (filePath);

        //找根节点
        XmlNode rootNode = doc.SelectSingleNode ("Bag");

猜你喜欢

转载自blog.csdn.net/Star_MengMeng/article/details/122898834