Using Unity 2019.4.20f1 and Addressables 1.18.4.
If the locally cached catalog.json
file is corrupted, Addressables is no longer able to download a (new) catalog from a remote location.
This is a problem, because it means once the cached catalog.json file is corrupt, the user cannot download any remote content anymore to repair the game.
A corrupted cached catalog.json file causes a chain of errors and exceptions when the Player is started and many (perhaps all) Addressables API’s stop working:
ArgumentException: JSON parse error: Invalid escape character in string.
System.Exception: Unable to load asset of type UnityEngine.AddressableAssets.ResourceLocators.ContentCatalogData from location C:/Users/Peter/AppData/LocalLow/DefaultCompany/BrokenCatalog/com.unity.addressables/catalog_data.json.
System.Exception: Unable to load ContentCatalogData from location D:/Projects/_BugReports/BrokenCatalog/BuildWin64/BrokenCatalog_Data/StreamingAssets/aa/catalog.json.
System.Exception: Failed to load content catalog.
OperationException : ChainOperation failed because dependent operation failed
Addressables - initialization failed.
OperationException : ChainOperation failed because dependent operation failed
Please see the attached video where I go over the problem in detail:
Reproduce
- Open project on Windows
- Open Build Settings and enable “Development Mode”
- Open “Addressables Profiles” window and activate “Editor Hosted”
- Open “Addressables Hosting” window and enable the “Local Hosting” service
- Select “Assets/AddressableAssetsData/Menu” and set BuildPath=LocalBuildPath and LoadPath=LocalLoadPath in the Inspector
- Click in the Addressables Groups window “Build > New Build > Default Build Script”
- Press from main menu “File > Build” and build a Win64 Player
- Select “Assets/AddressableAssetsData/Menu” and set BuildPath=RemoteBuildPath and LoadPath=RemoteLoadPath in the Inspector
- Click in the Addressables Groups window “Build > New Build > Default Build Script”
- Run the earlier built Player, press “Check for Catalog Update” and “Check for new Content” and notice it downloaded new content
- Close Player, switch back to Unity
- Open “Scenes/Menu.unity” and change the Main Camera background color
- Click in the Addressables Groups window “Build > New Build > Default Build Script”
- Run earlier built player
- In the Player press “Check for Catalog Update”
- In the Player press “Check for new Content”
- In the Player press “Load” and notice the scene has the same color you just edited in Unity.
- At this point you figured that content updates work
- Close Player, switch back to Unity
- Open “Scenes/Menu.unity” and change the Main Camera background color
- Click in the Addressables Groups window “Build > New Build > Default Build Script”
- In Windows Explorer open
C:\Users\%UserName%\AppData\LocalLow\DefaultCompany\BrokenCatalog\com.unity.addressables
- Open “catalog_data.json” in a HexEditor, change the file to corrupt it and save
- Run earlier built player
Actual
Player throws all sorts of errors and exception. “Check for Catalog Update” is no longer working
Expected
Even if the locally cached catalog.json file is corrupt, it must be possible to perform a “Check for Catalog Update” to download a working catalog again.
If the locally cached catalog.json file is corrupt, Addressables should provide an API API to find if the catalog is corrupt.
Notes
The catalog.json file is locally cached at:
C:\Users\%UserName%\AppData\LocalLow\DefaultCompany\BrokenCatalog\com.unity.addressables
The downloaded content is locally cached at:
C:\Users\%UserName%\AppData\LocalLow\Unity\DefaultCompany_BrokenCatalog
Deleting the corrupted catalog.* files allows the player to download a catalog update again.
7244993–872882–bugreport_1343727.zip (52.8 KB)