Why does Unity remove the .mainfest file when using AssetBundle hot update?

1) Why does Unity delete the .mainfest file when using AssetBundle hot update
2) Addressable hot update, breakpoint resume problem
3) In the linear space, use post-processing to solve the UI mixing problem


This is the 341st UWA technical knowledge sharing push, which selects hot topics in the UWA community, covers UWA Q&A, community posts and other technical knowledge points, to help everyone master and learn more comprehensively.

AssetBundle

Q: Why does Unity delete the .mainfest file when using AssetBundle hot update?

A: When using AssetBundle hot update, Unity will save the dependencies and metadata of each AssetBundle in a file named file.

This file describes the version of the AssetBundle, which resources it contains, and the dependencies between them.

The .mainfest file will be packaged when building the APK or releasing the AssetBundle package, and cannot be updated through the hot update method. If the file is not deleted during the AssetBundle hot update, the newly downloaded AssetBundle file will overwrite the original file, resulting in All AssetBundles that have already been downloaded will need to be re-downloaded as their dependency information has been lost. Therefore, files need to be removed from the packaging list when the AssetBundle hot update is performed to avoid this situation.

Thanks to Manhua@UWA Q&A Community for providing answers


Network

Q: Use Addressable for hot update, use the Disable Catalog Update on StartUp method, kill the game when the update progress is not completed, and then restart the game. At this time, the catalogs.Count is already equal to 0, and the update will not be triggered here, but in fact There are still some resources that have not been updated, what should I do in this case?

1. First of all, players cannot be allowed to enter the game because the resources do not match.
2. Trigger the game to re-update. At this time, catalogs.Count=0, and resources will not be updated.

  • In this case, is it possible to use Addressables.ClearResourceLocators() and Caching.ClearCache() to clear the cache and downloaded resources, and trigger the hot update again. At this time, catalogs.Count should not be equal to 0, right?

I don't know how everyone handles it: half of the resource update kills the game, and re-login the game?

In addition, does the AddressableAssetSetting->Catalog->Player Version Override setting use the default time stamp or specify a version number? I have specified a fixed version here, resulting in catalogs.Count=1, and always only update the difference between this time and the parent package. For example, there have been several hot updates in the middle, and the hot updates in the middle will be discarded. In response to this problem, what is the update strategy?

A1: Instead of using Addressables.UpdateCatalogs(), go to the server to download the Catalog file yourself. If the download is halfway through, cancel it without modifying the version number. Next time you come in, go to the server to download the Catalog file. Then the Catalog file downloaded by yourself can be loaded with Addressables.LoadContentCatalogAsync(), and then all the Keys of the IResourceLocator are obtained, and all Keys are passed into the download list to download resource files.

Thanks to liu@UWA question and answer community for providing answers

A2: Enter the game for the first time to check, and the subsequent asynchronous operations can be saved in the cache.

Thanks to Jingyi@UWA Q&A Community for providing answers

A3: First, if you use the Disable Catalog Update on StartUp method to start, the Catalog will not be updated by default. However, when you update later, the Catalog has actually been updated, and then calling the API to update the Catalog will naturally disappear. At this time, just go to GetDownloadSize and update resources directly.

Catalog update and resource update are two phases. Best managed separately.

Second, AA actually only compares the Hash of resources, so there is no concept of version number, so there is no intermediate version, and it is always the latest version and parent package. This PlayerVersionOverride refers to the version number of the Player you play, which is usually incremented when the parent package is updated. This approach can ensure that no matter which resource the player owns, it can be updated to the latest version, and avoid the intermediate version-by-version upgrade process.

Furthermore, Keys basically still need to be managed by yourself. For example, if you manage 20 Keys yourself, and then call Addressables.UpdateCatalogs() to tell you that 5 of them have been updated. Then if you call GetDownloadSizeAsync and DownloadDependenciesAsync immediately, you can pass in these 5 keys immediately. In another case, you may get 5 updates to UpdateCatalogs in this game. But you will not call GetDownloadSizeAsync and DownloadDependenciesAsync until the next time you start the game, then you can pass in all 20 Keys.

Thanks to Huang Cheng@UWA Q&A Community for providing answers


UI

Q: Linear space, art resources are made in Gamma space, refer to this method:
Alpha from Gamma space to Linner space conversion under URP (2) - Multi-Alpha texture superposition_urp gamma liner_euphorias' blog-CSDN Blog

The UI effect is correct, but the entire interface is obviously darkened. How do you solve this problem?

According to the tutorial on the Internet, it has been changed, and there are 4 more Blits. Is there still room for performance optimization?

A1: If you use URP, you can modify the URP source code, use linear space for the scene, and use Gamma space for the UI.

There are corresponding open source codes on Git, applicable to different versions of Unity, and there are some small bugs that need to be fixed:
UI_RenderPipelineInLinearSpace
URP-12-GammaUIAndSplitResolution

Thanks to Zou Bin@UWA Q&A Community for providing answers

A2: If there is post-processing on the Renderer of the 3D camera, and the URP pipeline can be changed, and LineraToGamma can be done directly at the end of UberPost's Frag, it may not need to add a pass.

Moreover, it seems that this post-processing script is hung on the UIRenderer, so it will affect the overall color. You can try to do a pow (color, 0.45) on the color after the ForwardRenderer renders and before the UI is drawn, which is LinearToGamma. The pow (color, 2.2) processed after neutralizing the last UIRenderer.

Thanks to Fan Shiqing@UWA Q&A Community for providing answers

A3: Aiming at the question of "Is there still room for performance optimization with 4 more Blits". Direct cmd.Blit(_source, _source, _material); will do.

Thanks to the question owner Huang Daxian @UWA Question and Answer Community for providing an answer

The cover image comes from the Internet


That's all for today's sharing. Life has a limit but knowledge has no limit. In the long development cycle, the problems we encountered are just the tip of the iceberg. The UWA community is willing to accompany you to explore and share together. More developers are welcome to join the UWA community.

UWA official website: www.uwa4d.com
UWA community: community.uwa4d.com

 

Supongo que te gusta

Origin blog.csdn.net/UWA4D/article/details/131529698
Recomendado
Clasificación