Unity资源加载机制www的坑

在不同的平台上运行时,www加载的路径不同,协议类型也有差别!

在unity编辑器模式或者苹果(ios)下加载资源:

string path=@"file:///"+ Application.streamingAssetsPath + "/" +"文件全名";//一定要加上@"file:///"
WWW www = new WWW(path);

在安卓平台上加载资源:

Application.streamingAssetsPath在安卓平台默认为有 "jar:file:///" 前缀,使用www加载可以直接使用
string path= Application.streamingAssetsPath + "/" +"文件全名"; 
WWW www = new WWW(path);

 

猜你喜欢

转载自www.cnblogs.com/RainPaint/p/11097855.html