• AssetBundle


    在unity中使用代码,理论上来说可以加载assetbundle。
     
    using UnityEngine;
    using System.Collections;

    public class AssetBundleLoader : MonoBehaviour {

         // Use this for initialization
         void Start () {
              StartCoroutine( LoadAssetBundle("file:///D:\Projects\cq_rip\DataAndroid\character\br_000_b.ab") );
         }
        
         // Update is called once per frame
         void Update () {
        
         }
        
         IEnumerator LoadAssetBundle(string url) {
              WWW www = new WWW(url);
              yield return www;
        
              GameObject obj = (GameObject)Instantiate(www.assetBundle.mainAsset);
              yield return obj;
         }
    }
     
    备注:在windows上需以file:///开头。
     
    得到的错误信息是:
     
     
    可以预想应该是unity版本不同,打开assetbundle,可以看到
     
     
    意思是兼容版本是3.x.x ~ 4.2.2f1吗?
     
    我使用的unity版本是4.1.5f1。开发团队使用的版本应该是4.2.2f1,它可以向下兼容某个范围的assetbundle?
     
    此报道网页也证实了unity版本至少是4.2。
     
    下载中。。。unity也越来越大了啊。。
    换个地方下载,用迅雷,快些。
     
    用unity 4.2可以正常deserialize assetbundle,但是却加载不出任何asset。可能的问题,为安卓做的assetbundle不能够在PC上加载。
    AssetBundleNamespace: UnityEngine
    Parent class: Object
    Description

    AssetBundles let you stream additional assets via the WWW class and instantiate them at runtime. AssetBundles are created via BuildPipeline.BuildAssetBundle.

    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.
     
    思路其实现在应该是这样的了,做一个简单的安卓项目,然后在安卓设备上解压缩。
     
    不过现在看来意义不是很大了,因为似乎没有办法做到在unity工程里面直接打开。
    我现在想看的就是那个初始场景的第一个模型,到底有没有子模型,各自用的是什么材质。
     
     
     
    不工作。可能还是有一些防护,或许是在serialize的时候可以有一些定制?
  • 相关阅读:
    基于Tire树和最大概率法的中文分词功能的Java实现
    通过 Spring RestTemplate 调用带请求体的 Delete 方法(Delete With Request Body)
    《高效能程序员的修炼》之译者序(本书将于7月初上市,人民邮电出版社)
    JVM类加载过程学习总结
    Web安全之Cookie劫持
    2016第40周五
    年轻By塞缪尔·厄尔曼
    2016第40周三
    2016第40周二
    果断歌
  • 原文地址:https://www.cnblogs.com/123ing/p/3944789.html
Copyright © 2020-2023  润新知