framework bundle多次加载注意
来源:互联网 发布:法兰克系统编程 编辑:程序博客网 时间:2024/05/24 07:37
转自:http://www.cnblogs.com/realtimepixels/p/3652128.html
2.assetbundle如果从WWW中被读取过一次,再读取会报错
当你把assetbundle资源用www下载下来后,往往都会使用“wwwResource.assetbundle”,但是注意,这个函数调用assetbundle的时候,只能调用一遍。意思是,当你要再次读取的时候,会报错。这时候,需要你写一套对于assetbundle的控制程序,保证第一次读取资源的时候是使用wwwResource.assetbundle,第二次再次利用,则要用已经读取出来的资源。
两个Bundle资源及依赖关系
BundleA->(dependencies)BundleB
BundleB
使用:
resMgr:LoadPrefab("BundleA", {}, function(objs) end)
resMgr:LoadPrefab("BundleB", {}, function(objs) end)
报错:can't be loaded because another AssetBundle with the same files is already loaded.
原因:OnLoadAssetBundle->
yield return StartCoroutine(OnLoadAssetBundle(depName, type));这次依赖下载没有进入request列表
在resMgr:LoadPrefab("BundleB" 进行了第二次bundle加载,导致重复bundle加载
解决:依赖加载时进入加载队列但是回调为空
IEnumerator OnLoadAssetBundle(string abName, Type type) {
string url = m_BaseDownloadingURL + abName;
List<LoadAssetRequest> requests = null;
if (!m_LoadRequests.TryGetValue(abName, out requests))
{
LoadAssetRequest request = new LoadAssetRequest();
request.assetType = null;
request.assetNames = new string[0]{};
request.luaFunc = null;
request.sharpFunc = null;
requests = new List<LoadAssetRequest>();
requests.Add(request);
m_LoadRequests.Add(abName, requests);
}
WWW download = null;
.........
//yield return StartCoroutine(OnLoadAssetBundle(depName, type));
yield return StartCoroutine(OnLoadAsset<GameObject>(depName)); //依赖加载不需要回调,类型无所谓
- framework bundle多次加载注意
- android bundle 使用注意
- OSX下编译framework bundle
- ios 打包framework以及bundle
- dex2oat 加载多次
- Bundle类加载器
- iOS 加载Bundle文件
- Framework加载
- MVC表单多次提交注意
- bundle传值时注意的问题
- eclipse bundle类加载器
- Bundle类加载器:classloader
- OSGI(二)加载Bundle
- org.osgi.framework.Bundle类解读
- IOS封装Framework,使用bundle管理资源
- framework--怎么样使用bundle来共享资源
- 运行Bundle时org.osgi.framework.BundleException
- fstream 对象多次使用时注意clear
- 自己整理的几个C面试小题
- Spring 集成hessian进行接口的暴露和访问
- 我的Java设计模式-单例模式
- [bzoj1606][Usaco2008 Dec]Hay For Sale 购买干草
- 解惑spring事务传播特性之嵌套事务
- framework bundle多次加载注意
- SpringMVC Controller介绍及常用注解
- Android中的Intent和Intent-filter总结
- android studio app显示红叉
- 单例模式02
- 【第二周项目3】体验复杂度
- 学习路程(慢慢添加)
- responseBody注解的使用
- oracle_10g卸载