0
点赞
收藏
分享

微信扫一扫

XML序列化和反序列化;从XML读数据和写数据,常用代码

捌柒陆壹 2022-02-12 阅读 48
xmlunity
using UnityEngine;
using System.Collections;
using System.Xml;

public class Test : MonoBehaviour {
    public string filePath = string.Empty;
    public string fileName = "/ss.xml";

    public string name,level;

    void Start(){
        WriteXML ();
        ReadXml ();
    }
     写数据
    public void WriteXML(){
        filePath = Application.dataPath;
        filePath = filePath + fileName;

        XmlDocument doc = new XmlDocument ();
        doc.Load (filePath);

        XmlNode rootNode = doc.SelectSingleNode ("root");

        XmlElement equipEle = doc.CreateElement ("Equip");
        XmlElement nameEle = doc.CreateElement ("
举报

相关推荐

0 条评论