当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
03 多线程与高并发 - ReentrantLock 源码解析
划重点!2022面试必刷461道大厂架构面试真题汇总+面经+简历模板
【微信小程序】信息管理与信息系统专业社会实习制作项目--垃圾指纹
用VbScript控制光驱
LeetCode Daily Question (858. Mirror Reflection)
ES 节点2G内存分析
yolo系列的Neck模块
MFC的相机双目标定界面设计
编辑器vscode Already included file name ‘xxx‘ differs from file name ‘xxx‘ only in casing报错
A discussion of integrated circuits
Small program on how to play in the construction of e-government service platform value
判断密码是否包含键盘连续字母
基于双层共识控制的直流微电网优化调度(Matlab代码实现)
《独行月球》猛药,治不了开心麻花内耗
聚焦数据来源、数据质量和模型性能构建小微企业信用画像
《会面》-凯瑟琳曼斯菲尔德(徐志摩译)
oracle sql中根据条件判断是否插入数据
SSRF-服务器端请求伪造-相关知识
What is DevOps?Enough to read this one!
TensorFlow学习记录(三):高阶操作 & 神经网络与全连接层