跨平台解决unity3d读取本地文件教程
using UnityEngine;using System.Collections;
public class VIPMainController : MonoBehaviour {
public TextAsset AssetText;
// Use this for initialization
void Start () {
print(AssetText.text);
}
// Update is called once per frame
void Update () {
}
void ClickMainCloseBtn()
{
Application.Quit();
}
}
或者读取Resources文件夹:
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
void Start() {
TextAsset asset = (TextAsset) Resources.Load("filename", typeof(TextAsset));
print(asset.text);
}
}
读取xml:
public TextAsset AssetText;
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(AssetText.text);
感谢楼主的无私分享!{:soso__11402694654016840197_7:} 好用吗哇咔咔咔咔咔咔咔咔咔咔咔咔咔咔咔咔咔咔咔咔卡
感谢楼主的无私分享! 楼主是超人 好帖就是要顶 顶顶多好 难得一见的好帖 LZ真是人才 好帖就是要顶
页:
[1]