unity读取服务器xml文件|unity读取数据库的内容生成xml文件保存本地

|

❶ unity pc版的打包完后 xml的配置文件放在哪个文件下才能读得到

在Assets文件夹下新建一个文件夹命名为StreamingAssets,StreamingAssets文件夹下的东西会原封不动的打包:文件路径:Application.dataPath+"/StreamingAssets"+"/你的文件.xml";或Application.streamingAssetsPath+Config.xml”;注意:不要脚本实例化的时候获取路径,简单的说路径要在用的时候再获取或在start、awake函数里面获取后赋给全局变量void Awake(){ xmlConfigPath = Application.streamingAssetsPath+Config.xml”;}如果有用望采纳O(∩_∩)O!

❷ unity读取数据库的内容生成xml文件保存本地

首先一个根节点表中每一行对应为一个子节点Id,Problem,ABCD四个选项,均作为其子节点(尽专量属不要有过多的属性,用节点去描述),正确答案作为属性比如:<problem><question1 answer='A是正确答案' ><question>问题内容</question><A>选项A</A><B>选项B</B><C>选项C</C><D>选项D</D></question1>…</problem>

❸ xml读取操根本作,在unity里可以运行,打包后根本没反应

路径问题 你使用 doc.Load(xmlpath ); 路径是全路径,带后缀~~~如果是 非 手机 端话,只要路径存在就可以读取~~但是如果是手机端话,那么就要受到手机文件权限的限制 如果放到Resource内,那么建议采取 xmlDoc.LoadXml(((TextAsset)Resources.Load(xmlFile)).text);使用这个函数读取,,不带后缀,传相对位置·~~~你多了解一下unity 特殊文件夹权限问题吧~~

❹ Unity如何用XMLParser修改.xml文件

一般对于XML文件都是以读取为主,如果要写入的话,用XMLParser是不行的,一般是用System.Xml。可以用里面的XmlDocument.CreateElement方法来写入节点,还是蛮方便的。具体可以去看看MSDN。

❺ unity中怎样读取xml文档

我不知道你有么有new一下,而且加载的时候直接用XmlDocument xmlDoc = new XmlDocument ();xmlDoc.Load (Application.dataPath+"/playerDate.xml");就行了啊,没必要是Loadxml啊

❻ unity通过读取配置文件(xml或者Json格式)可以设置物体在场景中的位置吗

可以的,,,,

❼ 如何在unity发布网页之后读取xml

当unity发布为web之后,想要运行之后在本机上面保存一个xml文件,并且读取,目前只找到了读取的方法。其实就是把本机当成是一个服务器端,web运行的时候从本机的URL上面读取一个xml文件,注意要把crossdomain.xml保存到c盘的wwwroot目录下 ,然后将要读取的xml文件放到发布之后的web文件下面的templets文件夹里面 ,unity代码: using UnityEngine; using System.Collections; using System.Xml; using System; using System.Text; using System.Collections.Generic; public class Test1 : MonoBehaviour { public string timeURL; public string all; public string id; public string start; public string end; public string content; public string fdate; public string idate; private string erro1; private string erro2; private string erro3; // Use this for initialization void Start() { timeURL = "http://127.0.0.1:82/templets/area.xml"; //这里填写格式 StartCoroutine(GetXML()); } IEnumerator GetXML() { Debug.Log("Start get GetXML"); WWW www = new WWW(timeURL); while (!www.isDone) { Debug.Log("Getting GetXML"); yield return www; all = www.text; Debug.Log("Finish getting GetXML and whole xml is : " + www.text); ParseXml(www); } } public void ParseXml(WWW www) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(www.text); XmlNodeList nodeList=xmlDoc.SelectSingleNode("list").ChildNodes; foreach(XmlElement xe in nodeList) { id = xe.GetAttribute("id"); start = xe.GetAttribute("start"); end = xe.GetAttribute("end"); content = xe.GetAttribute("content"); fdate = xe.GetAttribute("fdate"); idate = xe.GetAttribute("idate"); } } void OnGUI() { GUI.Label(new Rect(100,00,200,200),all); GUI.Label(new Rect(0,00,200,200),id); GUI.Label(new Rect(0,30,200,200),start); GUI.Label(new Rect(0,60,200,200),end); GUI.Label(new Rect(0,90,200,200),content); GUI.Label(new Rect(0,120,200,200),fdate); GUI.Label(new Rect(0,150,200,200),idate); } }

❽ Unity5怎么读取到Resources文件下的XML文件啊

XmlDocument xml = new XmlDocument(); xml.Load(Application.dataPath+"/Resources/"+"new.xml"); XmlNode root = xml.DocumentElement;

❾ 关于Unity部署安卓程序时读取配置文件的问题

放在Unity项目中名为StreamingAssets文件夹中的任何文件将会被一字不差地复制到目标机器上的特定文件夹里MAC/Win: path = = Application.dataPath + "/StreamingAssets";iOS: path = Application.dataPath + "/Raw";Android: path = "jar:file://" + Application.dataPath + "!/assets/";


赞 (0)