当前位置:网站首页>Unity 3D模型展示框架篇之资源打包、加载、热更(Addressable Asset System | 简称AA)
Unity 3D模型展示框架篇之资源打包、加载、热更(Addressable Asset System | 简称AA)
2022-08-04 12:41:00 【yxlalm】
本项目将整合之前Unity程序基础小框架专栏在Unity 3D模型展示项目基础上进行整合,并记录了集成过程中对原脚本的调整过程。增加了Asset Bundle+ILRuntime热更新技术流程。
前面文章中对项目功能完成项目框架整合,完成模型展示的基本功能,后续的篇幅主要进行资源热更和代码热更的实现。官方推出的Addressable Asset System进行资源热更简称AA,作者在网上找了不少介绍Addressables系统的文章,经过验证总结结合案例记录Addressables系统的使用经验。
使用AssetBundle形式,加载的时候要注意AB包之间的依赖关系,资源重复打包的问题,做资源热更新也要实现增量资源包的打包,然后自己实现热更检测、资源下载、MD5比对,解压等等逻辑过程繁琐麻烦,Addressable Asset System简化资源热更新的环节使得开发者进行资源热更新变得简单易上手。
项目安装Addressable Asset System,在Package Manager中搜索Addressables
进行安装
进行设置并使用,选择创建Groups。
将预制体Switch设置Addressable,可以发现他出现在窗口Addressables Groups进行属性操作。
资源命名
设置模式
进行构建
构建目录Library\com.unity.addressables\aa\Windows
修改MyGameManager代码改变资源加载方式,使用Addressables进行预制体加载。运行能够加载。
void Start()
{
//var tempDD = ResMgr.GetInstance().Load<GameObject>("Prefabs/Switch");
Addressables.LoadAssetAsync<GameObject>("Switch").Completed += (handle)=> {
// 预设物体
GameObject prefabObj = handle.Result;
GameObject tempDD = Instantiate(prefabObj);
tempDD.transform.SetParent(parentObj.transform);
tempDD.name = "Switch";
camera.LookAt = tempDD.transform;
camera.Follow = tempDD.transform;
tempDD.transform.position = new Vector3(5f, 0f, 50f);
camera.GetRig(1).LookAt = tempDD.transform;
};
}
修改预制体,将Cube隐藏
重新构建资源文件
选择.bin文件,平台是Windows打开
此时,报错Previous build had 'Build Remote Catalog' disabled. You cannot update a player that has no remote catalog specified
在AddressableAssetSettings中
设置和Group信息中的Content Packing&Loading路径一致,修改为远程更新目录
AddressableAssetSettings中的设置
Update a previous Build
配置文件夹中生成更新包
运行结果
下一步将使用远程服务器进行更新包的发布,程序进行资源更新检测及下载操作。
Addressables资源管理推荐文章:https://blog.csdn.net/linxinfa/article/details/122390621
边栏推荐
- 用VbScript控制光驱
- ES 节点2G内存分析
- 跨链桥已成行业最大安全隐患 为什么和怎么办
- How to develop small program plug-ins to achieve profitability?
- ShanDong Multi-University Training #4 A、B、C、G
- 【黑马早报】尚乘数科上市13天,市值超阿里;北大终止陈春花聘用合同;新东方花近200亿退学费和遣散费;张小泉75%产品贴牌代工...
- break与continue超详解!!!
- 【Game Of AutoTest】1、再度启程,重识游戏自动化测试
- 小程序对接企业微信客服
- ReentrantLock 原理
猜你喜欢
随机推荐
从零开始配置 vim(6)——缩写
聚焦数据来源、数据质量和模型性能构建小微企业信用画像
Neck modules of the yolo series
Valentine's Day Romantic 3D Photo Wall [with source code]
String是引用类型
LeetCode每日一题(858. Mirror Reflection)
从零开始配置 vim(7)——自动命令
Escape character is ‘^]’什么意思?怎么使用telnet
Focus!2022 interview must brush 461 interview questions summary + interview + resume template
倒计时 3 天|一起看云原生 Meetup 的六大议题
动规(18)-并查集基础题——团伙
rpm安装提示error: XXX: not an rpm package (or package manifest):
d不要直接用转串
num_workers
“蔚来杯“2022牛客暑期多校训练营3 C
动规(16)-并查集基础题——格子游戏
ShanDong Multi-University Training #4 A、B、C、G
分布式链路追踪Jaeger + 微服务Pig在Rainbond上的实践分享
【水一个徽章】
永磁同步电机FOC驱动代码讲解









