Low framerate when using lots of text nodes in gui


I need to use lots of text nodes in gui (around 70). In such case the frame rate drops substantially. How can I improve the situation? I’m running a debug version on windows.
Here’s what profiler shows:



Profiler shows 301 Draw Call, it seems like your GUI do not optimized.
Please read this topic about the draw calls optimization, it should help you:



It helped. I used templates with text nodes mixed with box nodes which broke batching. I’ve put text nodes to a separate layer and it worked out perfectly.
Here’s what profiler shows now:



Still too many drawcalls, you should try to get it under 100 for mobile.

1 Like


Ok, thanks, I will.



Yes, it should be possible to get lower than 100, probably a lot lower.

Do you know where you draw calls originate from? How many game objects and sprites do you have? How many gui components? Share a screenshot of the table to the right (Counters).



Well, yes, there’s a lot of nodes and many of them are text nodes with different fonts. I’m currently using a separate font for different font sizes (I was trying to get better text look, unfortunately it didn’t help, but I left it for a time being). Here’s the table to the right:



Are you using df/distance field fonts? You can make a custom material with a custom fp to add extra sharpness so that when text is scaled down it doesn’t get as blurry, then it’s more useful to use one font for multiple sizes.

1 Like


I’m using bitmap fonts because df font gets weird color tint when scaled too much. Is there such fp shader already exists? Shaders are my weak spot :pensive:



Example modification is very simple, you only halve the smoothing, or whatever value looks best for your project.

2019-06-13%2007_29_06-JointHookshot 2019-06-13%2007_28_40-JointHookshot

Top has this modification, bottom uses builtin. So you can see the builtin version turns grey when scaled down but reducing the smoothing helps to minimize that.

What do your fonts look like currently?

1 Like


I’m sure there’s more to be done with layers to reduce draw calls! Can you share a screenshot? In theory and sometimes in practice you can get draw calls down to the number of atlases+number of fonts+possibly one or two more if you want stuff both above and below text.

1 Like



Here’s a slightly different modification, instead of reducing all smoothing only reduce the edge. Again in each screenshot top is modified bottom is builtin.

This stays more consistently colored when scaled and looks a bit smoother.