资源大湿 发表于 2013-5-20 10:28

Unity3D AssetBundle 在Android机子上进行读取

我看到官方文档中说明:
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基础路径的地址public static string AssetbundleBaseURL
{
    get
    {
      if (Application.platform == RuntimePlatform.WindowsWebPlayer || Application.platform == RuntimePlatform.OSXWebPlayer)
      {
            return Application.dataPath + "/assetbundles/";
      }
      else if (Application.platform == RuntimePlatform.Android)
      {
            return "file:///mnt/sdcard/assetbundles/";
      }
      else
      {
            return "file://" + Application.dataPath + "/../assetbundles/";
      }
    }
}

aaabbbsss12345 发表于 2014-4-26 10:11

好好 好东西

angel29hao 发表于 2017-2-13 10:22

很不错

xiaop 发表于 2017-2-13 09:42

楼主是超人

angel29hao 发表于 2017-2-13 09:55

顶顶多好

pkwzsqsdly 发表于 2017-2-13 09:55

难得一见的好帖

HackerEva 发表于 2017-2-13 10:09

不错不错

yangjianhui6 发表于 2017-4-18 07:41

很不错

liu3xing3long 发表于 2017-4-18 07:56

真心顶

Haohan_Meng@163 发表于 2017-4-18 08:05

说的非常好
页: [1]
查看完整版本: Unity3D AssetBundle 在Android机子上进行读取