unity Android(安卓)csv 数据持久化
16lz
2021-01-24
unity读写csv参照这里:
http://www.cocoachina.com/game/20151217/14727.html
下列代码解决关于在Android端找不到.csv文件的问题,亲测有效
public void loadResourcesFile(string fileName) { strArrList.Clear(); StreamReader sr = null; try { sr = new StreamReader(new MemoryStream((Resources.Load(fileName) as TextAsset).bytes)); Debug.Log("file finded!"); } catch { Debug.Log("file don't finded!"); return; } string line; while ((line = sr.ReadLine()) != null) { strArrList.Add(line.Split(',')); } sr.Close(); sr.Dispose(); }
csv.loadResourcesFile("EnemyLayout2");
更多相关文章
- Android中对标准内核的按键映射以及按键驱动
- android 遍历assets下的文件
- 提示Android(安卓)requires compiler compliance level 5.0 or 6
- Android(安卓)数据存储与IO (二)
- ubuntu 删除android studio
- android获取手机内部存储空间和外部存储空间
- 自定义 listivew (android)
- Android(安卓)滑动返回Activity的实现代码
- Android内存泄露利器(hprof篇)