UMG: Scaled dynamic text in Grid/Horizontal/Vertical boxes "jumps" for 1 frame

I’m having a problem with UMG text widgets that’s been driving me a little bit batty. Basically, text widgets involved in scaled display while being within layout components exhibit a small shift in position the frame after they’re first displayed.

Let me give a more specific rundown of the situation that causes this issue:

  • The text widget is inside a layout component (i.e. a Grid, Horizontal or Vertical container)
  • The text widget itself OR the layout component as a whole is enclosed by a ScaleBox
  • The text within the text widget has to be large enough to require the ScaleBox to scale either the text or the enclosing element
  • Said text has been changed or updated at the construction of the enclosing widget

The issue manifests as what looks to be a single-frame layout error, the position of the text shifts very slightly from the first frame of display to the second. I have tried spawning the widget and then waiting with a delay. I have tried putting “Force Layout Prepass” nodes literally everywhere throughout my blueprints to no avail. The closest thing I’ve come to a clue is this question which, deep down in the answers, mentions a potential bug in how ScaleBoxes handle the arrangement of their children ( UMG: Visual artifacts when using auto wrap text - UI - Epic Developer Community Forums ) but I don’t have enough familiarity with the engine innards to know if this is on the right track or not.

I have found that in SOME cases I can stop this shifting issue if I set the Scale Box (specifically surrounding the Text widget in this case) slot’s properties to Fill/Fill, instead of Center/Center for horizontal/vert alignment. This results in a layout that is NOT what I want, but it does stop the text from shifting even when being scaled.

I’ve attached a sample project that exhibits the issue - You can just run the project. The button spawned in the upper left will repeatedly spawn and then despawn a UI component that exhibits the issue. If there’s ANY tips ANYONE can give me on eliminating this problem I’d very much appreciate it.

Sample project with issue

3 Likes