Author Topic: Batching Issue!  (Read 5420 times)

sb_007

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Batching Issue!
« on: November 28, 2017, 12:18:23 AM »
Sprites used in a Screen, are from same ATLAS. But, Batches are about 25 & Saved by batching is 0.

Font used: Dynamic

Shader used: Unlit/Transparent Colored (Default on creating ATLAS)

What Frame Debugger Says
This shader explicitly disables batching with the "DisableBatching" tag.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Batching Issue!
« Reply #1 on: November 29, 2017, 08:44:13 AM »
NGUI doesn't use Unity's batching system. It does batching itself automatically.

Dynamic fonts break up batching, so if you have this:

Sprite (depth 0)
Label (depth 1)
Sprite (depth 2)
Label (depth 3)

...you will have 4 draw calls because it's the only way to render everything properly. Instead you should be organizing your UI like this:

Sprite (depth 0)
Sprite (depth 1)
Label (depth 2)
Label (depth 3)

This will result in 2 draw calls because sprites will be batched with sprites and labels will be batched with labels.

If you stop using Unity's dynamic fonts and instead use atlas fonts, as recommended by NGUI's labels, you will draw the entire UI in 1 draw call and the depth order won't matter, making your job easier.

sb_007

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: Batching Issue!
« Reply #2 on: December 25, 2017, 11:47:15 PM »
Thanks!
What are the best practices for doing the same(use atlas fonts)?
Will Font Maker gonna help in this case?