Widget incorrectly positioned when set in Event Construct

Hi All,

today I run across a strange behavior in UE and was just wondering if this working as designed or if it’s a bug.

I need to draw a UI widget when the game starts, and I need it to be in the middle of the screen. So I was simply calculating ((viewport-size/2)-(desired-size/2))/viewport-scale. So with my test resolution of 1280x720 I was expecting X to be 640 but it always was 615, which was frustrating. With larger resolution the difference was even bigger.

So I played a bit around and found out that when the position set during “event construct” it’s having this incorrect position but when I set the widget position after it was constructed, through event-tick, it’s positioned correctly.

Why is there a different behavior depending on where you set the position and where is the correct place to set the widget position?

Thanks in advance!

Best regards,

One update to the issue. It seems to be working when I add a 0.1 sec delay between the Event construct and the function that draws and positions the widgets.