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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值