填坑:untiy用www读取persistentDataPath失败

遇坑:
pc端,www读本地persistantDataPath, 读完后 bundle.error = ‘Counldn’t read a file://file’

两个解决方案:
1.
www读的路径:’file://’ + Application.persistentDataPath 改成
‘file:///’ + Application.persistentDataPath

2.
把工程目录整个放到 C盘,就是和persistentDataPath一致的盘,那么’file://’也不会报错。

总结:
PC端最好用三个“/”,不然就要工程放C盘。

具体原理:
好像就是file:///就是等于后面的完整路径,是为了给www统一格式制定的标准。
而file://。。。不好意思,不想查了,有大神可以在评论指教。

你可能感兴趣的:(Unity遇坑填坑)