Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more..
    Dismiss Notice
  3. Dismiss Notice

Question Update build from addressables_content_state.bin does not rebuild the builtin asset bundles

Discussion in 'Addressables' started by jacky-kschou, Jul 23, 2021.

  1. jacky-kschou

    jacky-kschou

    Joined:
    May 4, 2013
    Posts:
    73
    Hello,

    I want to "update a previous build" with the addressables_content_state.bin to create a build that also rebuilds the builtin assets (The bundles in Library/com.unity.addressables/aa/Android/Android/ folder).

    So that I can next build a new player (for example a new apk) that also includes those assets.

    But it seems only rebuilds the remote assets. (The ones upload to cdn).

    How do I make it also rebuilds the bundles in Library/com.unity.addressables/aa/Android/Android/?

    Thank you very much.

    Jacky
     
  2. jacky-kschou

    jacky-kschou

    Joined:
    May 4, 2013
    Posts:
    73
    hello? : "((
     
  3. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,796
    I'll pass the along to the team to see if they have any guidance they can share.
     
  4. andymilsom

    andymilsom

    Unity Technologies

    Joined:
    Mar 2, 2016
    Posts:
    294
    Hi @jacky-kschou, I do not think you are using the content update workflow as it is designed. I would recommend looking through the documentation, https://docs.unity3d.com/Packages/com.unity.addressables@1.18/manual/ContentUpdateWorkflow.html

    I'll give you some other pointers here.

    The update workflow is designed to update a previous player build and not a new player build. Some unneeded bundles for the update can be deleted.
    e.g.
    Build new Addressables build
    Build Player (save the content_state file for the full (new build) Addressables build for this Player release)
    Update content for state
    Update content for state
    Build new Addressables build
    Build Player (now we have a new content_state to use for this player, based on the new Addressables build above)
     
  5. jacky-kschou

    jacky-kschou

    Joined:
    May 4, 2013
    Posts:
    73
    Hi andy,

    Thanks for the reply. In this case, when the player update their app from an old player to a new player version, do they have to redownload all the remote assets event they have no changes at all from the previous new player build? I tested with the workflow you mentioned and the new player build have to redownload everything.

    How can I avoid that? I want the new player build don't need to redownload the remote assets, because they have already download the exact same binary files from the previous player build.

    Thank you very much
     
  6. andymilsom

    andymilsom

    Unity Technologies

    Joined:
    Mar 2, 2016
    Posts:
    294
    As long as there are no changes in the bundle, they should build the same, resulting in the same filename and cache hash. The caching uses the bundle name in the url and the version hash. So as long as they remain the same, then the bundle will be fetched from the cache.
    I am not sure on all platforms, but deleting the app and then installing a new player can result in removing the cache files associated with it. e.g. iOS you can update the app and it will retain the cache, but deleting the app and installing will result in a cleared cache.

    If you make a new build and have bundles with changes that you are no expecting, we recommend extracting the bundles with Unity install/Tools/WebExtract and then convert the serialised files to text with Unity install/Tools/Binary2Text and compare to see the differences.
    You may have processes in your code making changes you are not expecting. If there are changes you think are bugs with Unity then it is good to make a bug report and we can investigate.

    One this to note is with shaders, sometimes different hardware can compile shaders with slight variations to each other, so building between multiple machines has the potential to result in different binary depending on the hardware.

    Look out in your code for any call to Caching.Clear, in case you have left something in that will clear the cache.
     
  7. jacky-kschou

    jacky-kschou

    Joined:
    May 4, 2013
    Posts:
    73
    Hi andy,

    Thank you so much for the reply again. That provides a lot of insights : )

    One think I did before building a new player build everytime is that I have a script of moving the assets in the "Resources" folder and move them to the "Resources_moved" folder to be packed by the addressable system, so the files are being moved back and forth.

    Do you think this is the reason why the hash vales are different every time with a new player build?

    Thank you very much.
     
  8. andymilsom

    andymilsom

    Unity Technologies

    Joined:
    Mar 2, 2016
    Posts:
    294
    No, this should not cause the Asset to be imported differently, and the guid will remain the same. There is a chance if you have Editor scripts that affect imports, or 3rd party scripts that do though. So I could not rule it out.