unity3d开发对Txt文件的读写
1.引入库
本地的txt文件的读取,需要引入System.IO
using System.IO;
2.读入数据
从StreamingAsset文件夹读取数据
public static string ReadFileFromStreamingAsset(string File_Name)
{
string File_Path;
if (Application.platform == RuntimePlatform.Android)
File_Path = "jar:file://" + Application.dataPath + "!/assets/" + File_Name;
else
File_Path = Application.dataPath + "/StreamingAssets/" + File_Name;
WWW www = new WWW(File_Path);
while (!www