UMG reducing FPS by more than half

Hi there fellow creators.
I’m having a problem where an UMG widget is making my FPS going from over a 100 to almost 40. That’s nonsense. I mean, the whole thing is made off of around 25 “Image” widgets with fairly complex materials attached to them but my framerate shouldn’t go down THAT much. After doing some analysis I found out this in the game thread using Unreal Frontend:

&stc=1

Something in the UMG, “Build Text” is taking 10 ms! Woah! I’m not even building, setting or removing any text at all from that particular UMG yet. What could be causing this huge performance problem?

Do you have any text in your game?

You could try opening up the console (~) in a running game and type stat slate and see what it says. You could also do, stat dumpave -num=100 -ms=0, which will dump the average of 100 frames worth of data without any of the stat slate rendering overhead.

The UMG has 3 Text Box widgets, but I’m not doing anything with them at this point. Actually, I tried removing them and I gained like 15 FPS just on that.
This is what my Stat Slate displays:

&stc=1

It basically states the same problems being Build Text, Build Element increasing my Total Tick Time to an average of 20 ms…

Also, not sure if I used the dumpave command properly, but here’s what I get:

&stc=1

Isn’t there anything specific I can do to figure out what is making me have this problem?

Are you creating your game’s UI like 100 times? Those stats say you’re arranging 7311 child widgets. That’s a far cry from 20 image widgets. Are you also in the editor? Your numbers seem way off for a cooked standalone game.

I’m only creating it once as far as I know… This is what I’m doing to spawn it:

&stc=1

And yes, I’m running this from the editor. Does running it from the editor affect performance THAT much?! I mean, when I do Remove from Parent the framerate goes back to like 100~110 FPS so it must be something with the UMG Widget.

EDIT: Also, I already have those 7000ish child widgets even when not spawning this particular widget. I get around 5000 even in new projects. I don’t think that is something that should be alarming.

&stc=1

Dunno why your frame rate is going down by that much why it’s active. You must be doing an awful lot of work inside the widget then.

Profiling in the editor isn’t an accurate method, the stats for slate include ALL slate, and since the editor is slate, you’re getting it too. The only accurate way is to build a stand alone game and gather your stats there.

When running the game in “Standalone” I do get better framerates, but the problem persists. Look:

This is when the widget is added to viewport.

&stc=1

And this is when the widget is removed from the viewport (Remove from Parent).

&stc=1

The problem is the same, that Build Text thingy… and I don’t know why. I’m not doing anything with those text widgets.
Also, I packaged the game just to see if in the final build I would get the same performance issue and yes, I get around the same framerates as when playing in Standalone mode.

Try removing the text widgets entirely, or set their visibility to collapsed. We had a bug awhile back where when users were setting them to a non-existent font file it was causing large perf spikes.

Ohhhhhhhhhhhhhhh, THAT was the problem! Thank you!
Man, this was harder to figure out than it should have been. Now my framerate has gone back to normal values.
This thread can be closed now. Thanks again!

Wow, thanks for this thread. I had the same issue on 4.7 and it turned out to be that I had left a font parameter null. The reason this is hard to find is that no error is thrown and the font still draws fine when setting default font to a bogus font or null.