How does UMG determine widget size on screen

So I made a widget to show player’s health etc…

I see it gets smaller on a smaller resolution which is what I want.

But I’m not sure how it knows the actual size of the widget. Is there a way to scale it specifically based on percent of screen height for example? Then I can do things like making my health bar take 5% of screen height no matter the resolution.

When I’m playing around with preview size in the UMG editor it resizes it according to some logic. But when I use a custom size it’s always uniform in size and doesn’t scale.

You can use anchors in the canvas to force the widget to be X% of the width of height of the canvas. If you canvas occupies the whole screen, then it will be X% of the whole screen.

The scaling logic it is based on is the DPI scale curve, you can access it from the project settings under User Interface, or use the DPI edit button right beside the scale of the UI noted in the bottom right of the designer view.

I just changed the way preview scaling works for 4.8 based on some internal feedback. In 4.8, you’ll be able to select preview screen size separate from how to fill said screen. The new options will be Fill Screen, Custom, Desired, Custom on Screen and Desired On Screen. All of the options ending in Screen will display the UI in the context of the selected screen size with the appropriate amount of DPI scaling applied. The ones that are just Custom/Desired will work as they currently do, displaying the widget at a 1:1 scale without the context of a specific resolution screen.