Unity导出PC端报错

mzhangzt 2017-06-20 03:06:15

Unity游戏导出PC报的错,怎么导出的时候一起把资源也导出来,不然他们报找不见资源的错
...全文
2130 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
tianmao111 2017-07-30
  • 打赏
  • 举报
回复
pc下,不应该带file//吧,路径要动态获取
mzhangzt 2017-07-11
  • 打赏
  • 举报
回复
我改成这样
public static readonly string LevelDir ="file//"+Application.streamingAssetsPath + @"/Levels";
string[] files = Directory.GetFiles(Consts.LevelDir, "*.xml");
运行到PC端报这个错了

但是这个文件夹也在
加载这个XML文件是这样加载的
tianmao111 2017-07-07
  • 打赏
  • 举报
回复
#if UNITY_EDITOR #if WWW string t_path = "file:///" + Application.streamingAssetsPath + "/"; #elif IO string t_path = Application.streamingAssetsPath + "/"; #endif #elif UNITY_STANDALONE_WIN string t_path = Application.streamingAssetsPath + "/"; #elif UNITY_IPHONE string t_path = Application.dataPath + "/Raw/"; #elif UNITY_ANDROID string t_path = "jar:file://"+Application.dataPath + "!/assets/"; #endif return t_path; }
tianmao111 2017-07-07
  • 打赏
  • 举报
回复
这要看你是通过什么方式读取这个路径的了,编辑器下和发布到PC下的路径不一样,路径前边要带file://
无名剑 2017-07-03
  • 打赏
  • 举报
回复
日志已经说得很直白了,就是找不到文件路径 你看下磁盘上有没有对应的文件夹
mzhangzt 2017-06-24
  • 打赏
  • 举报
回复
我是这样加载文件夹的
//得到LevelDir目录下所有.xml文件的数据
string[] files = Directory.GetFiles(Consts.LevelDir, "*.xml");
在Consts类中定义文件路径
public static readonly string LevelDir = Application.dataPath + @"/Game/Resources/Res/Levels";
结果在Unity中运行没任何问题,导入PC就报这样的错

2,535

社区成员

发帖
与我相关
我的任务
社区描述
Unity3D相关内容讨论专区
游戏unity 技术论坛(原bbs)
社区管理员
  • Unity3D
  • 芝麻粒儿
  • 「已注销」
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

Unity3D社区公告:

  1. 社区致力于解决各种Unity3D相关的“疑难杂症”。
  2. 社区不允许发布与Unity3D或相关技术无关内容。
  3. 社区版主邀请各位一道为打造优秀社区不懈努力。

试试用AI创作助手写篇文章吧