Download

Struggling to align text in UMG

I am trying to make some widgets that display information in-game (just solid background colour with text). The widgets need to be procedurally generated. I have no problem updating the text in the widgets, creating and removing them etc, but I am really struggling with layout.

I have been through a few UMG tutorials and I am still having trouble with choosing the right tools for the job. My main issue seems to be in the choice of background panel for my widget. Ideally it should always surround the text it contains, if that can’t be done dynamically then at least I want to set a fixed size for it and align the text. The “Canvas panel” tooltip says that it is not suitable for procedural generation and to give the widget a background colour it has been suggested that I should put the text inside a “border”. In the first image you can see my setup, in the second you can see what happens when I drag the widget into a new one.

I placed the vertical panels inside a horizontal panel (as I had seen this in a tutorial) to create two columns of text (static labels on left and dynamic info on right).

Can anyone suggest how this should be set up?