Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Bug catalog.json and settings.json do not respect hashes, and thus cause every new release to crash

Discussion in 'Web' started by zaneclaes, Jul 3, 2023.

  1. zaneclaes

    zaneclaes

    Joined:
    Mar 11, 2022
    Posts:
    2
    I am using AddressableAssets with WebGL. I build the assets using the Editor:

    ```
    AddressableAssetSettings.BuildPlayerContent(out AddressablesPlayerBuildResult assetsResults)
    ```

    I can see that the `catalog_[date].json` and `catalog_[date].hash` are both created, as expected. However, despite having "name files as hashes" enabled, I can see from the assetsResults (above) that the final output file is NOT named a unique name:

    ```
    "OutputPath":"Library/com.unity.addressables/aa/WebGL/settings.json"
    ```

    After building for WebGL, I then find that `aa/WebGL/` folder contains `settings.json`. This is extremely problematic because every time I publish a new version of the game, it breaks the game for some subset of existing players. The files are deployed via AWS S3 + Cloudfront... which I invalidate of course, but the cached settings.json remains on the end-user's computer. Looking at the network inspector tab, we can see that the user has the latest version of the game build itself (the unityweb files have hashes), but the settings.json file is outdated, and thus they load the incorrect assets and the game crashes.

    More to the point, it seems unreasonable to have a single settings.json file. Presumably if a prior version of the game is still on the server, the player should be allowed to load that version successfully. The fact that the settings.json is not hashed means that there can only ever be one version of the game at a time, and deploys cannot execute safely. For example, if I happen to upload the NEW settings.json file before uploading the new build files, players of existing versions will be broken until the new release completes.

    How can one enforce hashed filenames for `settings.json`?
     
    Last edited: Jul 3, 2023
  2. JeremyRabouan

    JeremyRabouan

    Joined:
    Jun 15, 2022
    Posts:
    1
  3. KamilCSPS

    KamilCSPS

    Joined:
    May 21, 2020
    Posts:
    448
    Might have better luck in the addressables section of this forum...