Unity Addressable魔改
- 开发
- 22
-
新增回调
- 在使用过程中,输出之后还需要手动拷贝到服务器上会麻烦,一旦未拷贝编辑器还会因为加载(同步加载)的问题卡死。所以可以到Unity的PacakgeCache中修改本地仓库中的Addressable对应版本的包。找不到位置可以用everything搜索一下,一般都在C盘中
- 在AddressableAssetSettings 新增回调
public static Action<bool> OnBuildFinish;
public static Action<bool> OnUpdateBuildFinish;
- 在AddressableAssetSettings.BuildPlayerContentImpl中将原有的输出结果检测逻辑替换为下面的逻辑
if (!string.IsNullOrEmpty(result.Error))
{
Debug.LogError(result.Error);
Debug.LogError($"Addressable content build failure (duration : {TimeSpan.FromSeconds(result.Duration).ToString("g")})");
OnBuildFinish?.invork(false);
}
else
{
Debug.Log($"Addressable content successfully built (duration : {TimeSpan.FromSeconds(result.Duration).ToString("g")})");
OnBuildFinish?.invork(false);
}
- 在ContentUpdateScript.BuildContentUpdate中将原有的输出结果检测逻辑替换为下面的逻辑
if (!string.IsNullOrEmpty(result.Error)){
AddressableAssets.OnUpdateBuildFinish?.Invork(false);
Debug.LogError(result.Error);
}
else{
AddressableAssets.OnUpdateBuildFinish?.Invork(true);
}
原文地址:https://blog.csdn.net/a1092484359/article/details/140324888
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。
本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:https://www.suanlizi.com/kf/1811071386421170176.html
如若内容造成侵权/违法违规/事实不符,请联系《酸梨子》网邮箱:1419361763@qq.com进行投诉反馈,一经查实,立即删除!