Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics

[Solved!] Can Save Drawcall Batches?

A topic by Anthony Law created Jun 11, 2018 Views: 248 Replies: 6
Viewing posts 1 to 7
(1 edit)

Hi KaiClavier, 

I am new to Super Text Mesh and is trying to see if it is suitable to replace the text component of UGUI.  I noticed that each Super Text Mesh object with default shader takes 3 drawcall batches, whereas the one with drop shadow shader takes 5 drawcall batches. If I have multiple Super Text Mesh objects of the same font and shader, the total batches will be number of Super Text Mesh x 3 and they cannot be batched!  

1. Will performance be affected if drawcall batches cannot be saved?

2. Is there any way to save the batches?

Developer (1 edit)


The way STM currently works, I believe it batches materials for each individual mesh at the moment. It creates a new material using the "material" variable as a base because each font will need a new material. But at the moment, these generated materials are only shared between the mesh they exist on, not all meshes in the scene. I'll see what I can do about this, as this would be a pretty good performance boost for a scene with multiple materials.

That said... I've had customers ship mobile games and never tell me about performance issues, period? So I don't think performance will be affected, but I'll still see if I can do anything to batch materials per-scene instead of per-mesh.

The next patch going up already cleans up GC to practically be gone, so that's already a big performance boost, if any!

Edit: also, this might be caused by shader passes, and I'm having my shaders optimized for a future patch... I'll let you know if that fixes this!

Thanks very much for your quick reply. I also noticed that an  STM object takes 1 drawcall batch, whereas an STM UI object takes 3 drawcall batches. Does that matter?


That's a good catch - the UI shader in specific is the cause for the shader rework as it has another edge case issue.

Surely enough, swapping out the shader with unity's default shader removes the two extra drawcalls, so it looks like the shader is the cause.

If you want to use the shader I just used, it's "GUI/Text Shader" in Unity. The new shaders will be built to work similarly to that one so it should be compatible! The only thing its missing from the future updated shaders are the dropshadow/outline effects.

Do you expect that there will be performance gain if I use STM instead of UGUI's text? I don't have a good setup to test that at the moment. 


I can't think of anything that would make STM use more performance than UGUI text when rendering the same thing, both are just meshes being rendered with specific materials in the end.


Hey! Got an update on this.

In an empty scene with just a single STM object in it:

Old UI shader: 4 batches

Unity's GUI/Text Shader: 2 batches

New UI Shader: 2 batches

So, that's that! The new shaders are in v1.8.2, and that's out on itch already and will be on the asset store when it gets approved.