找回密码
 立即注册
楼主: 小米

[脚本] Unity3D AssetBundle 在Android机子上进行读取

[复制链接]
发表于 2013-5-20 10:28 | 显示全部楼层 |阅读模式
我看到官方文档中说明:
Note that bundles are not fully compatible between platforms. A bundle built for any of the standalone platforms (including webplayer) can be loaded on any of those platforms but not on iOS or Android. Furthermore, a bundle built for iOS is not compatible with Android and vice versa.

但是我们看到,用以下步骤进行在Android机子上使用AssetBundle

重点有2点:

Use the option "BuildTarget.Android".
Describe the path with triple slash "file:///"
以下是步骤:

Delete directories "Per Texture Materials", "assetbundles", and so on.  把已经导出过的包删掉
Use the option "BuildTarget.Android" to all "BuildPipeline.BuildAssetBundle".   要把BuildTarget为Android平台!!!
Run these on Editor. Character Generator/Generate Materials Character Generator/Create Assetbundles Character Generator/Update Character Element Database  
Copy Assetbundles database to Android device which like "/mnt/sdcard/assetbundles/"  把这些包放到Android的指定目录下
Modify AssetbundleBaseURL. (the point was "file:///") 修改获取AssetbundleBaseURL基础路径的地址
  1. public static string AssetbundleBaseURL
  2. {
  3.     get
  4.     {
  5.         if (Application.platform == RuntimePlatform.WindowsWebPlayer || Application.platform == RuntimePlatform.OSXWebPlayer)
  6.         {
  7.             return Application.dataPath + "/assetbundles/";
  8.         }
  9.         else if (Application.platform == RuntimePlatform.Android)
  10.         {
  11.             return "file:///mnt/sdcard/assetbundles/";
  12.         }
  13.         else
  14.         {
  15.             return "file://" + Application.dataPath + "/../assetbundles/";
  16.         }
  17.     }
  18. }
复制代码

评分

参与人数 2鲜花 +2 收起 理由
afteryunlei + 1
cxbsr + 1

查看全部评分

发表于 2014-4-26 10:11 | 显示全部楼层
好好 好东西
发表于 2017-2-13 10:22 | 显示全部楼层
很不错
发表于 2017-2-13 09:42 | 显示全部楼层
楼主是超人
发表于 2017-2-13 09:55 | 显示全部楼层
顶顶多好
发表于 2017-2-13 09:55 | 显示全部楼层
难得一见的好帖
发表于 2017-2-13 10:09 | 显示全部楼层
不错不错
发表于 2017-4-18 07:41 | 显示全部楼层
很不错
发表于 2017-4-18 07:56 | 显示全部楼层
真心顶
发表于 2017-4-18 08:05 | 显示全部楼层
说的非常好
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-11-25 23:05 , Processed in 0.108814 second(s), 29 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表