TextBlock inside Retainerbox is offset to the side if set to Align Text Center

Voxel.Entmt
Wed, 21 Apr 2021 16:08:00 +0000
Community & Industry Discussion

There is a bug with the Retainerbox which causes Textblock elements to not center the text correctly if the Application scaling is different than 1 (so on higher dpi monitors or on mobile devices).

Also, the bug goes away if you disable the “Retain Render” setting in the Retainerbox component.

Steps to reproduce:

1. In a new project create a new UMG widget

2. Add a retainerbox and a canvas as a child (see attached screenshot for hierarchy)

3. add another canvas as a child of the canvas (to be able to change the size of the widgets inside)

4. add an image to be used as background for the text block

5. add a Textblock (same width as image) and set the justification to “Align Text Center”

6. Enter play mode on a screen bigger than 1080p or set the Application scale to 2.0 in the project settings (this bug happens only when the scaling is different than 1)

Expected: The text should be centered

Result: The text is offset to the side (if the scaling is > 1.0 the offset is to the right, if it is < 1.0 it offsets to the left)

UI Setup with centered text:

Result is offset text to the right:

12 posts - 11 participants