unity Android在streamingAssets路径下文件无法读取的的解决方法
2024-10-19 14:51:29
unity Android在streamingAssets路径下文件,有时候plugin下的.jar或者.so无法直接读取;
解决方法之一,拷贝至其他路径:
#if UNITY_ANDROID
string s = Application.streamingAssetsPath + "/s/ss.txt";
string filePath = Application.persistentDataPath + "/s";
if (!File.Exists(filePath+ "/ss.txt"))
{
using (WWW www = new WWW(s))
{
yield return www;
if (!string.IsNullOrEmpty(www.error))
{
Debug.Log(www.error);
}
else
{
if (!Directory.Exists(filePath))
{
//创建文件夹
Directory.CreateDirectory(filePath);
}
File.WriteAllBytes(filePath+ "/ss.txt", www.bytes);
}
}
} #endif
最新文章
- 基于 HTML5 的 Web SCADA 报表
- POJ 2251 BFS(简单)
- 解读JSP的解析过程
- 函数对象适配器之ptr_fun的使用示例
- 【linux】文字提取
- PHPCMS V9添加模板自定义全局变量
- 进程产生的三种方式:fork、system和exec
- Android Animation ---TranslateAnimation
- linux常用命令及安装软件命令
- 一个少了context的赋值的错误
- 1. android
- [转载]cookie
- Warensoft Stock Service Api客户端接口说明
- DIV正确打开方式 ~~~~哈哈哈
- [转帖]你云我云•兄弟夜谈会 第三季 企业IT架构
- 根据指定的key,将二维数组的value转换为string,适用于mysql的in查询
- STARTTLS is required but host does not support STARTTLS
- 第二章 使用unittest模块扩展功能测试
- linux 3.10 的又一次hung
- shiro 密码的MD5盐值加密