码迷,mamicode.com
首页 > 其他好文 > 详细

AssetBundle

时间:2014-08-29 14:26:47      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:des   android   http   os   使用   io   ar   for   art   

在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:///开头。
 
得到的错误信息是:
bubuko.com,布布扣
 
 
可以预想应该是unity版本不同,打开assetbundle,可以看到
bubuko.com,布布扣
 
 
意思是兼容版本是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工程里面直接打开。
我现在想看的就是那个初始场景的第一个模型,到底有没有子模型,各自用的是什么材质。
 
bubuko.com,布布扣
 
 
不工作。可能还是有一些防护,或许是在serialize的时候可以有一些定制?

AssetBundle

标签:des   android   http   os   使用   io   ar   for   art   

原文地址:http://www.cnblogs.com/123ing/p/3944789.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!