Testing outside the editor, I’m using C++ to render a widget on a 1920x1080 viewport
It should render text dead center
In the C++ widget code I center the widget using:
FVector2D size {};
if (GEngine && GEngine->GameViewport)
GEngine->GameViewport->GetViewportSize(size);
SetPositionInViewport({size.X / 2, size.Y / 2});
I’ve checked the size variable and it is indeed 1920/1080
The widget blueprint itself has a canvas with a single text block inside it
The text block is anchored to the center, position is 0.0/0.0, alignment is 0.5/0.5, size to content is ticked, justification is align text center and pivot is 0.5/0.5
All looks good in the widget editor, the text is center
When I run the game, the text is a tiny bit off from the center of the screen
I know this because if I set the text block pivot to 0.7/0.7, it looks better
Obviously 0.5/0.5 is correct for center
So what is going on? Is some sort of DPI value making it off center?