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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Do sprites actually batch?

Discussion in '2D' started by NerdRageStudios, Mar 23, 2016.

  1. NerdRageStudios

    NerdRageStudios

    Joined:
    Nov 1, 2013
    Posts:
    167
    screenshot.png By design do sprites contained in multiple tileset actually batch?

    I created a single PNG spritemap for my dungeon floor, sliced it up and then duplicated it many times to make the level, but I see a huge number of batch calls, but no batching actually occuring?

    Is this by design, or do you have to do simething to make duplicated tiles batch?

    I should mention that they have a tag and are set as static.
     
  2. jc-drile77

    jc-drile77

    Joined:
    Jul 1, 2014
    Posts:
    229
    They do batch, they have to be on the same image tho (or use sprite packer).
    I do not know how does it actually work.
    But formy project using sprite packer saved me tons of draw calls
     
  3. NerdRageStudios

    NerdRageStudios

    Joined:
    Nov 1, 2013
    Posts:
    167
    They are all in the same image, I only have 1 PNG file in my project, I have also tried using the sprite packer, but nothing, no sprite batching at all.
     
  4. spryx

    spryx

    Joined:
    Jul 23, 2013
    Posts:
    556
    Would like to know the answer to this as well. I think they do batch, but it is not apparent from the stats...
     
  5. jc-drile77

    jc-drile77

    Joined:
    Jul 1, 2014
    Posts:
    229
    Untitled-2.png
    In my case it´s clear that sprite packer saves batches :C
    Played around changing z, static, tag and color and none change the batches
     
  6. NerdRageStudios

    NerdRageStudios

    Joined:
    Nov 1, 2013
    Posts:
    167
    I guess what is confusing me is the "saved by batches" I thought this showed you what unity was optimising internally in terms of draw calls, dynamic batching etc.
     
  7. jc-drile77

    jc-drile77

    Joined:
    Jul 1, 2014
    Posts:
    229
    That might only work with 3D, I guess 2D batching is processed in a different way
     
  8. originalterrox

    originalterrox

    Joined:
    Feb 6, 2015
    Posts:
    40
    Not sure how to check if sprite batching is working or not. I have tints applied to 2D sprites with a pixel snap material and am not sure.
     
  9. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    As stated above, it's the "batches" stat. Tinting sprites is handled with vertex colors rather than different materials, so batching still works.

    --Eric