How to - Optimize Floating Damage Text (Actor, not Widget)

Something else I’ve come across in the past is the following…

FText’s FormatText isn’t Free
Calling FormatText is vital to creating localizable UIs. However FormatText isn’t free. I’ve seen one example of it taking 0.04ms per call on PS4. You should especially avoid calling it every frame. Instead call it only when it needs to be changed using delegates and events. Or cache the value you’re using for the FormatText (e.g. an integer), and only update your text when the value itself changes.

SetVisibility isn’t Free
If you’re like me, you maybe assumed that calling SetVisibility on a widget is very performance-light, or that calling SetVisibility(Hidden) on an already hidden widget is effectively free. It’s not. Calling SetVisibility every frame with your desired visibility is very easy, but it can also be surprisingly heavy. As with FormatText, you should change your UI so that SetVisibility is only called when a change of state is needed.

Both taken from Unreal UIs and Performance · ben🌱ui (benui.ca) (at the bottom)

I know I’ve been guilty of the last one.

1 Like