资源大湿 发表于 2013-4-2 19:36

跨平台解决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);

jerry6084 发表于 2013-5-6 05:44


感谢楼主的无私分享!{:soso__11402694654016840197_7:}

山外轻烟 发表于 2016-9-23 16:12

好用吗哇咔咔咔咔咔咔咔咔咔咔咔咔咔咔咔咔咔咔咔咔卡

crimesky 发表于 2017-1-20 16:07


感谢楼主的无私分享!

bug-maker 发表于 2017-2-9 21:02

楼主是超人

kill 发表于 2017-2-9 21:17

好帖就是要顶

kexuan 发表于 2017-2-9 21:15

顶顶多好

kill 发表于 2017-2-9 20:56

难得一见的好帖

咖啡里的童话 发表于 2017-2-9 21:47

LZ真是人才

javacnee 发表于 2017-3-6 22:26

好帖就是要顶
页: [1]
查看完整版本: 跨平台解决unity3d读取本地文件教程