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

Package an asset in the build then update it with addressables

Discussion in 'Addressables' started by JiMMaR, Oct 22, 2018.

  1. JiMMaR

    JiMMaR

    Joined:
    Aug 4, 2012
    Posts:
    12
    I'm trying to have some sprite sheets packaged in the game [iOS/Android] but then be able to update them later on.
    currently each bundle can either be local or remote, is there a way to have it local but still be able to update it remotely ?
     
  2. PaulBurslem

    PaulBurslem

    Unity Technologies

    Joined:
    Oct 7, 2016
    Posts:
    79
    Hi - the short answer is yes, there is a way :)
    The current version of Addressables (.4.x) does not support loading multiple objects from an asset (sprites from sheets, animations from fbx, etc) but that support will arrive in .5x. You would mark the sprite sheet asset as addressable and then load like this: Addressables.LoadAssets<Sprite>("MySpriteSheet"). This returns and IAsyncOperation<IList<Sprite>> that you can set your callback for.

    With that out of the way, here is how content updates work:
    Every time you build the player, there is a playerBuildVersion embedded in it that is also used to name the remote catalog. This version and some additional state data is also stored in a binary file with the build (named content_update_state.bin). Any asset groups that have a ContentUpdateGroupSchema (and have the StaticContent property set to true) will save asset dependency data in this file. From the Addressables window you can select Build->Prepare For Content Update and then browse for the content update file. This will be used to detect any shipped (local) assets that have changed and need to be moved to a remote group. The new group will be made with any modified assets (and it can be edited afterwards also). Once you are ready to make the update, use the Build->Build For Content Update. You will then browse for the same content update file and a player build will be made using the previous player build version. This creates a new content catalog and hash file that overwrites the existing one, forcing the player to use the new catalog and the new locations of the modified assets.

    Some caveats:
    This is done on a per asset basis, not per object. This means that entire assets will need to be re-downloaded if something in them changes or a dependency changes. Ideally you would organize your data in such a way that only remote bundles would need to be updated.
     
    Chocolate-Pi and JiMMaR like this.
  3. Chocolate-Pi

    Chocolate-Pi

    Joined:
    Oct 17, 2015
    Posts:
    8
    This is fantastic news; thanks to the team for making this possible!