Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: sb_007 on November 28, 2017, 12:18:23 AM

Title: Batching Issue!
Post by: sb_007 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.
Title: Re: Batching Issue!
Post by: ArenMook 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.
Title: Re: Batching Issue!
Post by: sb_007 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?