Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Deny Updates and keep working with the old packages?

Discussion in 'Addressables' started by faolad, Oct 10, 2019 at 8:44 AM.

  1. faolad


    Jan 27, 2013
    Is there a way to use the local cache copy of the remote data. Instead of updating it?

    example: the player doesn't want to update, but rather play with the current version he had install
    Last edited: Oct 11, 2019 at 7:08 AM
  2. Favo-Yang


    Apr 4, 2011
    A common use case I believe, but not supported well in the current system. The problem is that to detect content update, you need load remote catalog first, but then you lose the the connection with cached asset, because the old catalog has been "overwritten".

    The complexity of solution can be various depending on the graduation of version control. To get started with the easiest case, I assume the whole remote content update is atomic (update everything to next version or not). I haven't implemented such feature, so I can only stretch out some directions.

    ## Version control on catalog level.

    1) Prepare a catalog for each update, and do not place it into the the default remote catalog load path, but somewhere else.
    2) You detect the new catalog when available (on your own), and prompt user to download. The user can of course deny the update, and continue with cached assets, because addressable haven't aware the existing of the new catalog, until the app loads the new catalog manually.
    3) The GetDownloadSizeAsync is not usable any more, you need find a way to estimate the download size of new catalog.

    I guess this is the easiest way to go.

    ## Version control on label level.

    It may also work, if you manually load the new catalog which contains a version label for all assets. Then at the runtime, you will have both assets available to use, and you can load address and filter it with version label (using the MergeMode). But if you relying on AddressReference helper class, you need a modified version that can filter version based on current context.

    ## Change the system behaviour.

    You need hack the system, to make it save and expose the last successful downloaded catalog. Then you have the connection to that old catalog even after loading new catalog. You can still load new catalog, use GetDownloadSizeAsync to estimate download size, and if user deny the update, you can still load the old catalog back.

    Talk is cheap, sorry that I don't have any code samples to share.

    I remember unity dev may offer version control feature at some level, but not this year.
    Last edited: Oct 15, 2019 at 7:58 AM
  3. unity_bill


    Unity Technologies

    Apr 11, 2017
    Some changes we have coming soon that will hopefully help with this:

    1. the ability for game code to, at any time, ask "are there new catalogs" and then "update catalogs"
    2. the ability to turn off this "update catalogs" call from automatically happening during startup.

    This won't totally help the situation of "user doens't want a big download" however. Because the only way for you to know how much stuff needs downloading, is to update the catalog, and then call GetDownloadSizeAsync. So for the case of allowing the user not to download, it'd have to be a "do you want to download new updates?" without a specific size. Or you write an extension that gets the new catalog, loads it in an alternate space, and then gets download size separately. but that's obviously a bit complex.
    Favo-Yang likes this.
  4. Favo-Yang


    Apr 4, 2011
    Sounds good, that will simplify the "first option" I stretch out.

    Maybe the system can split the catalog operations into 3 steps: detect, fetch and load. Then it will be easier to implement the extension you described. Think about git, you can fetch the upstream, but pull later.