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

What cause UI batching breaks?

Discussion in 'UGUI & TextMesh Pro' started by mangax, Jul 3, 2017.

  1. mangax

    mangax

    Joined:
    Jul 17, 2013
    Posts:
    333
    hello!

    i don't know how to solve this issue.. i looked around on web/forums.. and i tried applying suggested approaches.. but without success!

    in my game play view i have UI image elements that refuses to batch!

    i tried naming them under same packing tag as "UI" .. (tested and tried different tag)
    they are on same format "png" + same import settings..
    they don't overlap on scene.. (i even separate them far each to test.. still didn't work)
    their parent have it's own canvas..
    tested and disabled/enabled all shadow/outline effects..
    disabled any script updating these UI elements..
    their z position all set to 0...

    and still images don't batch!!
    even frame debugger doesn't show suggestions for UI..

    in this screen shot.. it's literally each image is counted + one additional draw call for text..
    (only one crescent image is batched bcz its used twice..)
    Screen Shot 2017-07-03 at 6.27.58 PM.png

    so what's am doing wrong? this is unity 2017 (also same issue on unity 5.6.1)
    i remember long ago at times when i hit play .. i see a window saying something about building sprite or something.. but i didn't see it recently when editing imports or hitting play...
     
    Last edited: Jul 4, 2017
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    Sounds like the sprites are not all on the same atlas. If you open the FrameGrabber it should give some hints why things are not batching. Make sure all the sprites have the same packing tag. You can then force the atlas to be generated or change your editor setting to do this.
     
  3. mangax

    mangax

    Joined:
    Jul 17, 2013
    Posts:
    333
    thanks for replay!
    ahhh what i really meant earlier by tag .. is the packing tag

    you mean the frame debugger??
    this is a screen shot of frame debugger...
    Screen Shot 2017-07-04 at 8.28.37 PM.png

    i attached a test scene.. same images format am trying to batch but in new project.. and still not batching..
     

    Attached Files:

  4. daxiongmao

    daxiongmao

    Joined:
    Feb 2, 2016
    Posts:
    395
    I think text can screw it up sometimes. Try moving all your text after your sprites.
     
  5. mangax

    mangax

    Joined:
    Jul 17, 2013
    Posts:
    333
    try the sample project i included.. no text.. and still not batching..
     
  6. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    Your example project batches for me. Are you checking the stats during play mode?
     
  7. mangax

    mangax

    Joined:
    Jul 17, 2013
    Posts:
    333
    wow really? yes i check it in play mode.. it shows 6 batches..
    am using macbook pro 15 (late 2016 model)

    this screen from play mode + frame debugger:
    Screen Shot 2017-07-05 at 12.34.39 AM.png
     
  8. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    Go to Project Settings/Editor.
    Make sure the Sprite Packer is enabled.
     
  9. mangax

    mangax

    Joined:
    Jul 17, 2013
    Posts:
    333
    wow interesting!!! i might found a bug??

    i have set it earlier it to the last option "always enabled" and it didn't batch at all..
    now i set it to always enabled on legacy... and it batched!!!!
    then i returned back to the option "always enabled".. and now it is batching on this option!

    so i did this..
    i changed UI packing tag on import settings...
    i have it selected on always enabled! and it didn't batch again!..

    i had to select legacy in order to work again...
     
    Last edited: Jul 4, 2017
  10. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    Interesting. The reason its still bathing when you changed back is probably because it has now generated the atlas and so will continue to use it unless it is cleared.
     
  11. mangax

    mangax

    Joined:
    Jul 17, 2013
    Posts:
    333
    always enabled on legacy seems like on older version kept in unity?
    then the new one at "always enabled" not working??

    Anyway thanks alot for help!
     
    Last edited: Jul 5, 2017
  12. vexe

    vexe

    Joined:
    May 18, 2013
    Posts:
    644
    Legacy mode is, well the legacy sprite packer that works off of tags. The new sprite packer doesn't work off of tags. Right Click in Project Window | Create | Sprite Atlas and add your sprites manually to the atlas asset.
     
  13. ByMedion

    ByMedion

    Joined:
    May 10, 2018
    Posts:
    19
    @karl_jones Hello! Looks like this bug is still not fixed... Unity 2020.3.24.
    "SpriteAtlas V1 - Always Enabled" was selected and there is no batching in editor or play mode.
    I switched to "SpriteAtlas V1 - Enabled For Builds" and back to "SpriteAtlas V1 - Always Enabled" and now it works.
     
  14. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    Could you please file a bug report?