AssetBundle加载资源的过程
来源:互联网 发布:怎么开淘宝直播间 编辑:程序博客网 时间:2024/05/22 17:00
参考:http://blog.csdn.net/jason_520/article/details/54616953
AssetBundle加载资源的过程
1、加载总Manifest文件;
2、获取相关依赖文件列表;
3、加载所有相关依赖文件;
4、加载目标资源;
5、卸载所有相关依赖文件。
参考代码如下:
IEnumerator LoadAsset() { //首先加载总Manifest文件; WWW wwwAll = new WWW(BundleURL+ "StreamingAssets"); yield return wwwAll; if (!string.IsNullOrEmpty(wwwAll.error)) { Debug.LogError(wwwAll.error); } else { AssetBundle ab = wwwAll.assetBundle; AssetBundleManifest manifest = (AssetBundleManifest)ab.LoadAsset("AssetBundleManifest"); ab.Unload(false); //获取依赖文件列表; string[] depends = manifest.GetAllDependencies("cube.unity3d"); AssetBundle[] dependsAssetBundle = new AssetBundle[depends.Length]; for (int index = 0; index < depends.Length; index++) { //加载所有的依赖文件; WWW dwww = WWW.LoadFromCacheOrDownload(BundleURL + depends[index], 0); yield return dwww; dependsAssetBundle[index] = dwww.assetBundle; } //加载我们需要的文件; WWW www = new WWW(BundleURL + "cube.unity3d"); yield return www; if (!string.IsNullOrEmpty(www.error)) { Debug.LogError(www.error); } else { AssetBundle assetBundle = www.assetBundle; AssetBundleRequest request = assetBundle.LoadAssetAsync("cube", typeof(GameObject)); // Wait for completion yield return request; // Get the reference to the loaded object GameObject obj = request.asset as GameObject; Instantiate(obj); assetBundle.Unload(false); } //卸载依赖文件的包 for (int index = 0; index < depends.Length; index++) { dependsAssetBundle[index].Unload(false); } } }
0 0
- AssetBundle加载资源的过程
- Unity的动态加载AssetBundle资源笔记。
- AssetBundle-----资源加载(读取assetbundle)
- unity AssetBundle 加载资源 笔记
- AssetBundle系列——资源的加载、简易的资源管理器
- unity的assetbundle加载
- AssetBundle的加载
- Unity3D之AssetBundle【3】AssetBundle资源加载管理器
- Unity3D之AssetBundle资源加载封装
- Unity3D之AssetBundle资源加载封装
- Unity3D AssetBundle 资源加载-IOS
- Unity3D AssetBundle 资源加载-IOS
- WWW动态加载AssetBundle场景资源
- 基于AssetBundle的客户端资源
- Unity5.3.5的AssetBundle加载
- AssetBundle的制作与加载
- unity学习日记:AssetBundle工作流程之资源的打包与加载
- AssetBundle(2)AssetBundle的加载和使用
- css设置各种中文字体如雅黑、黑体、宋体、楷体等等
- 兔子只数问题
- python http 认证 auth oauth 认证
- Nacicat for Oracle 绿色版 亲测可用
- 内核写文件
- AssetBundle加载资源的过程
- 干货 | Generative Adversarial Networks(GAN)的现有工作(2016.02)
- 版本库
- 科锐课堂笔记:2017/4/5 输入输出
- 数据库数据execl导出
- android 相关知识整理
- asp.net中从数据库中读取数据,有对应的吧checkbox选中
- 记录一下使用AS一路踩得各种坑
- 在Angularjs中动态生成dom元素,如何动态编译