Search Unity

When using SpriteAtlas assets, individual images are also packed when building

Discussion in '2D' started by rankornfeld, Nov 14, 2018.

  1. rankornfeld

    rankornfeld

    Joined:
    Sep 29, 2016
    Posts:
    57
    We are moving to the (not so) new feature of using a SpriteAtlas asset instead of packing tags, since Unity does not allow using both methods.

    When we used packing tags, the Sprite Packer created the atlases for us, and when we built our game, individual images where not included in the target binary, only the atlases (as expected). We are using the Editor log to monitor what assets are packed.

    When we moved to a SpriteAtlas asset, we can see both atlas and images are included in the build! this is according to the Editor log:
    Code (csharp):
    1. Used Assets and files from the Resources folder, sorted by uncompressed size:
    2. 8.0 mb    2.5% Built-in Texture2D: sactx-1024x2048-Uncompressed-HairAtlas-5c158d62
    3. ...
    4.  98.4 kb    0.0% Assets/Sprites/Avatar/FaceImages/Male/F_M_03.png
    In this snippet, the atlas includes the image, so I would expect it not to appear in the Editor log, like we have seen when using the legacy sprite packer.

    Any ideas why we see that?
     
  2. lightmont

    lightmont

    Joined:
    Oct 8, 2016
    Posts:
    13
    Hi @rankornfeld
    the issue you described in the post is also happening in our project (Unity 2018.3.11f1 and previous 2018.3 versions as well). It's strange that images are also being included in builds when you expect to only atlases to be added.

    You posted in November 2018, almost 5 months ago.
    Have you got new information on that and possibly found a solution?

    Thanks!
     
  3. ed_s

    ed_s

    Unity Technologies

    Joined:
    Apr 17, 2015
    Posts:
    165
    @Venkify can you help explain the behaviour here?
     
  4. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    644
    @rankornfeld @lightmont

    The idea of Sprite-Atlas is to pack source textures of as many sprites to a single texture and use it as texture for the sprites in the runtime.

    In the log above, sactx-1024x2048-Uncompressed-HairAtlas-5c158d62 (8.0 mb) is the only Texture asset exported.
    Assets/Sprites/Avatar/FaceImages/Male/F_M_03.png (98.4kb) represents the Sprite asset only contains Sprite data and not its source texture. Please feel free to ask if you need more info.
     
    lightmont and ed_s like this.
  5. lightmont

    lightmont

    Joined:
    Oct 8, 2016
    Posts:
    13
    Thank you @Venkify
    It's clear now. That's good news. That means the build size does not increase.