unity 加载Assetbundle文件夹路径需要注意

unity2017:  

测试时 在Editor下加载Assetbundle文件夹下路径成功 在Android下使用www一直失败 使用Assetbundle.loadfromfile可以

  发现:加载Assetbundle文件       使用AssetBundle.LoadFromFile的路径是path,那么使用www加载需要前缀 "File://"+path才可以 ( Application.persistentDataPath;)

     加载StreamAssets路径下同理,  www需要加前缀 "jar:File://";   ( Application.dataPath + "/!/assets")

    AssetBundle.LoadFromFile不需要前缀:

   ------------------20180320更新------------------

AssetBundle.LoadFromFile对于Android有无前缀都无所谓。

   string pathTest0 = Application.dataPath + "!assets" + "/"+ fileName0;   //0 ok:/data/app/ttt.tta.taw-2/base.apk!assets/mapdata.unity3d

   string pathTest3 = Application.streamingAssetsPath + "/"+ fileName0;  // 3 ok:jar:file:///data/app/ttt.tta.taw-2/base.apk!/assets/mapdata.unity3d

这两个路径都是对的 虽然 3多了 3 ok:jar:file:///前缀

unity文档解释Application.streamingAssetsPath中Android有误   

 注意 pathTest0中"!assets"内没有/

改变自己
原文地址:https://www.cnblogs.com/sun-shadow/p/8497026.html