关于Resources.Load()和 AssetBundle.Load()
2015-07-22 10:12
218 查看
关于Resources.Load()
Resources.Load();
Resources.LoadAll();
Resources.LoadAssetAtPath();可以找到不在Resources目录下的文件。
例如:
ResourcesManager.Load<AssetBundle>(URL,delegate(UnityEngine.Object object){});
关于AssetBundle.Load()
AssetBundle obj = object as AssetBundle;
if(obj!=null)
{
TextAsset txt = obj.Load("data", typeof(TextAsset)) as TextAsset;
byte[] bytes = txt.bytes;
BinaryFormatter formatter = new BinaryFormatter();
MemoryStream stream = new MemoryStream(txt.bytes);
Hashtable datas = (Hashtable)formatter.Deserialize(stream);//反序列化
}
Resources.Load();
Resources.LoadAll();
Resources.LoadAssetAtPath();可以找到不在Resources目录下的文件。
例如:
ResourcesManager.Load<AssetBundle>(URL,delegate(UnityEngine.Object object){});
关于AssetBundle.Load()
AssetBundle obj = object as AssetBundle;
if(obj!=null)
{
TextAsset txt = obj.Load("data", typeof(TextAsset)) as TextAsset;
byte[] bytes = txt.bytes;
BinaryFormatter formatter = new BinaryFormatter();
MemoryStream stream = new MemoryStream(txt.bytes);
Hashtable datas = (Hashtable)formatter.Deserialize(stream);//反序列化
}
相关文章推荐
- Android Broadcast、content porvider和AIDL的区别和场景
- Android下拉刷新完全解析,教你如何一分钟实现下拉刷新功能
- windows驱动开发
- CENTOS6.3 配置防火墙,开启80端口、3306端口
- JS获取CSS属性值
- HibernateTemplate、HibernateDaoSupport两种方法实现增删改查Good
- Scala学习资料
- MVC4过滤器(转)
- 【一天一个canvas】制作渐变式PPT背景(十五)
- 上传、音频、视频
- 第k小数
- 模板模式和策略模式的区别【转】
- Sliding Window Maximum
- 接入微信SDK64位包报错
- Linux 制作和打补丁
- 我的一些简单的shell脚本实例
- 避免浏览器内存泄露
- 230题——Kth Smallest Element in a BST(二叉搜索树,中序遍历)
- 搭建Eclipse PHP开发环境
- hdoj统计字符