Unity Android及PC 外部Xml读取
2014-04-25 20:00
489 查看
using UnityEngine;
using System.Collections;
using System.Xml;
public class Test : MonoBehaviour {
public UILabel label;
private WWW www;
void Start()
{
string url = Application.streamingAssetsPath + "/tip.xml";
label.text = url;
if (Application.platform == RuntimePlatform.Android)
{
www = new WWW(url);
}
else
{
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(url);
label.text = xmldoc.OuterXml;
}
}
void Update()
{
if (www!=null&&www.isDone)
{
label.text = www.text;
}
}
}
MI 2SC 运行效果
using System.Collections;
using System.Xml;
public class Test : MonoBehaviour {
public UILabel label;
private WWW www;
void Start()
{
string url = Application.streamingAssetsPath + "/tip.xml";
label.text = url;
if (Application.platform == RuntimePlatform.Android)
{
www = new WWW(url);
}
else
{
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(url);
label.text = xmldoc.OuterXml;
}
}
void Update()
{
if (www!=null&&www.isDone)
{
label.text = www.text;
}
}
}
MI 2SC 运行效果
相关文章推荐
- unity PC和android不同平台读取xml文件比较
- 读取XML ,IOS、Android、PC
- unity Android 打包后读取 xml 文件
- unity Android 打包后读取 xml 文件
- Unity读取xml(android)
- unity Android 打包后读取 xml 文件
- Unity打包内部prefab和读取外部assetbundle的方法详解。
- android学生管理系统,利用linerLayout,实现xml的读取和写入,以及按钮的事件处理
- 如何外部修改AndroidManifest.xml中android:scheme的值
- Unity在Android中读取文件
- 【AS3代码】读取外部XML
- Android 开发笔记-- 读取原始XML
- android开发步步为营之24:milliondollars游戏技术要点代码生成控件和读取xml文件
- android使用SharedPreferences读取xml数据
- [Unity][Android][LUA][IOS]读取写入txt文件
- 读取外部的XML文件
- android XMLPullParser读取xml文件
- android应用面试宝典(下);用自定义组件控制循环组件使用bug还添加标志显示答案标志位;通过包名读取配置文件AndroidManifest.xml
- android_xml解析之 使用SAX读取XML文件
- 使用 ApplicationInfo 读取 AndroidManifest.xml 中的meta-data信息