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. Dismiss Notice

Why do i need "Sprite Packer" if i'm already using "Packing Tag" in my 2D game

Discussion in '2D' started by Bruder, Feb 17, 2016.

  1. Bruder

    Bruder

    Joined:
    Aug 9, 2014
    Posts:
    56
    Hi All,

    I'm building a 2D game and i'm using "Packing Tag" to pack my Sprites and save batches.

    My questions is: Why do we need the "Sprite Packer" to put the icons in one sheet, isn't it already done when using the "Packing Tag"?
     
  2. spryx

    spryx

    Joined:
    Jul 23, 2013
    Posts:
    556
    The packing tab is like a table of contents for the sprite packer.... It tell it which "page" to put the sprite on. This makes it possible to group sprites into an atlas by specifying the same packing tab for those sprites. For example, you may have sprites for world 1 with packing tab of world_1, the end result is that all of those are packed into the same atlas. (I'm purposefully simplifying this by ignoring compression)
     
  3. Bruder

    Bruder

    Joined:
    Aug 9, 2014
    Posts:
    56
    Thanks,

    So i understand the "Sprite Packer" is only viewer for my sprite sheets that are automatically created after assigning the "packing tag"?
    And unless i want to change the "Packer policy" i don't really have to open it. Right?
     
  4. spryx

    spryx

    Joined:
    Jul 23, 2013
    Posts:
    556
    Not really. The sprite packer is responsible for packing the sprites into the sheets (atlases). You can view the sprite sheets manually if you want to inspect how they are packed. The packer policy gives some additional control over what the packing process does to place all the sprites into an atlas. I don't think I have ever had the need to change it.

    The packing tag allows you to specify an atlas to pack a sprite to. If you leave it blank, the packer will try to pack all of your sprites into a default single atlas if it can. Some things make it pack into another atlas, for example: setting a single sprite to a higher color depth than the others in the atlas.

    At its core, all the sprite packer does is create a very large sprite (aka: atlas) from many single sprites. This saves draw calls when using multiple sprites. Every time the gpu has to fetch another sprite, it needs an additional draw call. If the gpu only needs to fetch a single, large sprite (atlas), it can simply use pieces of that large sprite for individual sprites, thus saving on draw calls.
     
    Bruder and theANMATOR2b like this.
  5. Bruder

    Bruder

    Joined:
    Aug 9, 2014
    Posts:
    56
    Thanks, spryx!