U3DC.COM | 优三帝研究院

Menu

加载StreamingAssets目录Cannot resolve destination host错误

现象:使用WWW或者UnityWebRequst加载StreamingAssets目录时,提示:Cannot resolve destination host,无法解析目标主机。

原因:Android平台直接使用Application.streamingAssetsPath不会有问题,但是,iOS平台和Editor环境,则要自行添加文件头。

解决方案:

PC平台下:
"file:///" + Application.streamingAssetsPath + 你的资源
Android平台:
Application.streamingAssetsPath + 你的资源
IOS平台:
"file://” + Application.streamingAssetsPath + 你的资源

另外,两个路径拼接,推荐使用Path.Combine, 而不是直接使用+连接。

打赏
— 于 共写了361个字
— 文内使用到的标签:

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据