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

Retainer Box is getting some love in 4.27:

Hopefully this goes away.

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:

I wish that was the case. That change already went into 4.26, and broke a ton of uses of RetainerBoxes. Unreal Engine Issues and Bug Tracker (UE-107863) is currently 3rd highest voted unresolved 4.26 bug, and on our project I had to manually revert that change to get it into a somewhat workable state. Both versions, however, still have other bugs, such as scrollboxes having incorrect hit testing after being scrolled when inside a RetainerBox (even indirectly). As much as I love RetainerBoxes because they let me use pretty UI materials, they have been an inexhaustible source of bugs.

I had issue with retainer box (both alpha gradient on borders and Scale transform) with the 4.25. I confirm that the 4.27.1 solved this issue. Thank a lot because to have provided this info because I was driving myself crazy trying to figure out this ^^

I am having the same issue in 4.27.2
Any solutions?
It happens for text input box ,text and rich text underline effects. They are all offsetted. Also when using the auto wrap line in text line height is half the normal size meaning texts in different lines get mixed together.

Can you give the following console command a try:

Slate.EnableRetainedRenderingWithLocalTransform 0

This should resolve a lot of the issues with text + retainer boxes.

4 Likes

Ok this helps, but alignment is still off. A workaround is to set the DPI scale Rule to “Custom” and dont choose any class. It will give you a warning in the editor, but the alignment is correct when you do so.

The issue still persists in 5.0.3. Any news on a proper fix for this?

2 Likes

Bump for 2024 as this failure still exists in 5.3

2 Likes

Can confirm

Did you find a solution to this, same issue in 5.3

Setting it to custom makes UI not scaling to the resolution, is there a better way to fix this? Same problem found in 5.3…