Widget - Shape Bidirectional Text bad performance

I will do my best to explain what the problem is. This project is a side project I am using for learning Databases and is a placeholder for a card game project I may make in the future. If I can’t find an answer to my problem, I will be OK with it.

In the screen shots below you will see magic cards. I am using magic the gathering’s database for now since it is large and lets me test the several things that can be done in UE4. I am NOT making a magic game since I hold no copyright to the cardart, frames or card text.

I created a deck builder system for the card game. The Level has no objects in it, just the widget overlay, with child widgets. It pulls text from a Database asset created from an excel file for each card.

I created it in 4.16.0 and when I load several cards into the vertical scrollbox, the frame rate goes below 15fps. I wasn’t able to figure out why, so I gave up.

When 4.18.0 came out I decided to try the project again. And to my happiness, it seemed fixed, the frame rate was 60fps+. So I added more stuff to the project. It was good in 4.18.0 - 4.18.3 I built with the Release versions.

When 4.19.0 Release came out I updated to it (I use perforce, so all my versions are backed up) and the problem with the frame rate is back.

When comparing both versions in a packaged version (and in editor), I noticed that the two major differences were the “Shape Bidirectional Text” and “Text Layout” were causing the lag (shown using “Stat Slate” console command). Screenshots below.

I did two tests in 4.19…

  1. I took my CardFaceBase widget and set all the TextBlock’s visibility to “Collapsed”. The frame rate was 60fps.

  2. I reset the visibility to “SelfHitTestInvisible” and change all the fonts I’m using to the default font (just in case the custom font was causing it). The frame rate was 15fps again.

So I am pretty sure it has to do with the TextBlock. No bindings are being used, the TextBlock is updated by SetText function. Also I am not using anything on tick. Is it doing something every frame it didn’t do in 4.18?

note: I did see something about bidirectional text in the 4.17 Release notes, but I never opened the project in 4.17 so I am not sure if the low frame rate was present there and then back in 4.19.

So ultimately my question is, does anyone know what could of changed in the TextBlock code that is causing it?

Here is the card widget

Here is the StatSlate report from a packaged 4.18.3 game. GOOD

Here is the StatSlate report from a packaged 4.19.0 game. BAD

Our team faced the same problem. If you type in any text field characters count more than about 3000, then the avalanche dip of the FPS begins. The more characters, the worse. In 4.18 there is no such problem! In 4.19, something was clearly broken.

Hi!
I’ve got the same problem and I found some sort of solution. In my case if I set “Single layout pass” on ScaleBox component of my widgets then I do not get performance drop at all. Maybe this will help you too.

Thanks Karsten, this may be the solution. I am getting a way better frame rate in the editor. I want to test the changes in a packaged game as well after work today. I will mark the answer as accepted after I run the tests later.

I updated to 4.19.2 and packaged the game. The framerate is 60fps. So setting the Scalebox’s performance to “Single Layout Pass” solved the problem. Thanks Again Karsten!!!

Sorry for necroing the thread!

I’ve searched everywhere for Single Layout Pass without success.
Where do you find this value?
UMG / Slate - BP / CPP?
Thanks for any help!

Hi Ericho,
They removed Single Layout Pass in version 4.24. I switched to using Invalidation boxes.
Here is my post about it…

2 Likes