当前位置:网站首页>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
边栏推荐
- 分布式链路追踪Jaeger + 微服务Pig在Rainbond上的实践分享
- Control CD-ROM with VbScript
- 小程序对接企业微信客服
- 干货丨数学规划视角下的分货优化解题思路
- MySQL - Explain详解
- 广告电商系统开发之订单处理
- Practical sharing of distributed link tracking Jaeger + microservice Pig on Rainbond
- rpm安装提示error: XXX: not an rpm package (or package manifest):
- Flutter教程大全合集(2022年版)
- 倒计时 3 天|一起看云原生 Meetup 的六大议题
猜你喜欢

持续交付(四)Jenkins多线程任务执行

Do you understand the various configurations in the project?

持续交付(二)PipeLine基本使用

"Lonely Walking on the Moon" is a powerful medicine, it can't cure the internal friction of happy twist

炫酷又高效的数据可视化大屏,做起来真的没那么难!丨极客星球

【PHP实现微信公众平台开发—基础篇】第2章 微信公众账号及申请流程详解

A comprehensive understanding of MOS tubes, an article is enough

什么是 DevOps?看这一篇就够了!

Cool and efficient data visualization big screen, it's really not that difficult to do!丨Geek Planet

接入华为游戏防沉迷,点击防沉迷弹窗后游戏闪退
随机推荐
Django框架MySQL数据库到models模型的映射关系
基于双层共识控制的直流微电网优化调度(Matlab代码实现)
Neck modules of the yolo series
【Game Of AutoTest】1、再度启程,重识游戏自动化测试
js正则表达式提取内容
关于mysql join 的一些说明
Focus!2022 interview must brush 461 interview questions summary + interview + resume template
双目立体视觉笔记(二)
【自动微分实现】反向OO实现自动微分(Pytroch核心机制)
Practical sharing of distributed link tracking Jaeger + microservice Pig on Rainbond
常用代码模板1——基础语法
抽奖/秒杀/竞价/评分/权威/投票,技术教你用合适的方法做好活动
Flutter教程大全合集(2022年版)
双目立体视觉笔记(三)三角测量、极线校正
七夕疯狂搞钱的年轻人,一周赚14万
d不要直接用转串
Launcher app prediction
num_workers
跨链桥已成行业最大安全隐患 为什么和怎么办
大神们都在用的神器,你和大神只差一个它!!