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

Resolved Sprite Atlas Assets and Asset Bundle Packing is creating large asset bundles that expected

Discussion in '2D' started by leif_bbltime, Apr 27, 2023.

  1. leif_bbltime

    leif_bbltime

    Joined:
    Feb 15, 2017
    Posts:
    5
    To set the stage, the project I'm working on is a major overhaul of a project that was in Unity 2018.4 and we're porting it to Unity 2021.3.

    We're going from the old Asset Bundles system with the old (and depricated) Sprite Packerover to the Sprite Atlas Assets and Addressables Asset Bundles.

    The new asset bundles are roughly 200%+ the size of the old asset bundles. So, I've been analyzing the contents of the built asset bundles.

    Old: Texture2Ds of the packed atlases, and Sprite asset data
    New: Textures2Ds of the packed atlases, and Sprite asset data, plus seemingly uncompressed Texture2Ds for every single individual Sprite.

    I'm looking at a size difference of 2~ MB for the old asset bundle vs 11~ MB for the new asset bundle (with what is intended to be the exact same assets)

    No matter what I've tried I can't seem to figure out, well, anything. Everything thing I've tried has just come back like a circle and I end up coming to the same conclusion. "Why are there RGBA32 Texture2D for every Sprite asset inside the asset bundle?"

    Any kind of insight or direction to try would be deeply appreciated.

    Resolved.

    So here's how I worked things out. I added the Sprites folders to an Addressables group and Include in Build = False. When I actually build, the Atlases and just the Sprites are pulled into the asset Bundles, the Texture2D for the individual sprites are not.
     
    Last edited: Apr 28, 2023
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,951
    That does seem wrong. Are those textures perhaps marked as read-write enabled? That could be enough to get them "chained on" by reference to their sprites.
     
  3. leif_bbltime

    leif_bbltime

    Joined:
    Feb 15, 2017
    Posts:
    5
    Thanks for the idea, I'll give that a try tomorrow when I get back to work.