Search Unity

How to use sprite renderer to load images using addressables?

Discussion in 'Addressables' started by Hazardam, Jun 12, 2019.

  1. Hazardam

    Hazardam

    Joined:
    Jun 12, 2019
    Posts:
    1
    I've recently encountered the 4gb limit bug. I'm making a 2D game that has many high-resolution background images. The images are displayed using the Sprite Renderer component that's attached to an empty GameObject.
    Now I'm learning to use the new addressable asset system in order to reduce the size of my resS file.
    However, after reading and watching many tutorials, I'm still having a lot of trouble.
    I've added all the images into the addressable Default Local Group package.
    What's the best way to load the images through addressables?
    I've spent a few days looking into this, I'd be so grateful if you could point me in the right direction.
     
  2. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
    Basically any unity file has a 4GB limitation, included asset bundle (.bundle), to work on old file system. So you just need a packing strategy conforms to it.

    You can organize assets of a scene into one asset group, which packed into a single asset bundle by default. This way you manually segment assets by scene, which probably less than 4GB each. You end up with a few mid-sized bundle files.

    Or organize all assets into the local group, as you already did. Then change the group setting, bundle mode to "Pack Separately". This way each asset is packed into individual asset bundle file. You end up with many small-sized bundle files.

    After you click Build > Build Player Content, you'll find the asset bundle files under /Library/com.unity.addressables/StreamingAssetsCopy/. You can check how it works.

    Loading sprite is trivial, please follow the doc https://docs.unity3d.com/Packages/c...8/manual/AddressableAssetsGettingStarted.html
     
    Last edited: Jun 13, 2019
    Dalton-Lima likes this.