Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

The right way of updating game using Addressables

Discussion in 'Addressables' started by Kapteeni-Studios, Jun 28, 2020.

  1. Kapteeni-Studios

    Kapteeni-Studios

    Joined:
    Apr 5, 2014
    Posts:
    39
    Hi,

    I just released my game using Addressables. Everything seems to be working as far as I know by reading player feedback. This game is quite big by size and remotely downloading about 100MB of content because Google Play has the 150MB limit.

    I just made a new update to the game with small changes, and I've chosen the "Build > New Build > Default Build Script."

    In my ServerData/Android folder, there are already files about 100MB size. My remote server folder looks like this (I use the Duplicate Assets bundle as an example).

    The first build with Addressables
    95MB file (first bundle file)
    duplicateassetisolation_assets_all_ad9a3ad44a89fadf55f5dc9ca854f85f.bundle

    The latest build with Addressables added a new bundle file. And now, my remote folder looks like this.

    95MB file (first bundle file)
    duplicateassetisolation_assets_all_ad9a3ad44a89fadf55f5dc9ca854f85f.bundle
    95MB file (latest bundle file)
    duplicateassetisolation_assets_all_11b8d6a64f1b0bdd0e78e1e09cae38a2.bundle

    My question is that now that players update the game, will they be receiving additional 100MB content? The first time they downloaded the game with 100MB and now another 100MB. Will Addressable remove the previous files from the device cache? I worry that I'm doing this wrong, and when players download the new update, it will grow the game size in the device twice as size as it should be. And every update the game size will grow by +100MB, which will be a problem.
     
  2. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    583
    Only the modified/new assets should be downloaded again, if cache is enabled. So you can see your first bundle file has the same file name (with the same hash) so it won't need to re-download it, it will just pull from the cache. New assets obviously will need to be downloaded.

    The other part of your question,
    Will Addressable remove the previous files from the device cache?
    the answer is unfortunately, currently, no. If you change an asset so that it generates a new hash (new file name), that's essentially a new asset to the system, and it will download it and the old asset will remain on the device in an unreachable state (like a memory leak, but actually a disc leak). I believe they are working on a solution to that problem, but that's just how it is for now. If it's a real problem, you can always call
    Caching.ClearCache()
    to clear all the bundles, but then all of them will have to be re-downloaded (you could implement that as a user option in case their disc space gets too full... terrible UX but at least it's an option).