How can I have the HUD adjust to the resolution?

I’ve read a few questions about this but I still am not sure how this works. I am working on a project with a few friends and when they play the project the HUD is off. I know we are using 1080 but what would cause the HUD to be misplaced on theirs. And if I change my resolution down to say 720, then its really messed up. I followed this tutorial.
HUD Scale to Ratio

I have the function setup yet I am not sure how to plug it up. The tutorial doesn’t say when to call the function in the HUD.

Here is a link to another, very similar, question where there are several blueprint answers and my C++ answer. They should help you understand how to deal with multiple resolutions.

LINK

Let me know if something confuses you =)

I have looked at a few of those answers but I am still confused. The way I have it setup I think would work but doesn’t exactly. I have my X and Y set into a Vector2d. I then break that and divide by a number to set a position. It works somewhat but when you change resolution the spacing is a little bit different. I assume its because I am dividing. So the objects will still come up in the general area but they are not in exactly the same spot.

Try this :

There are two output pins in “Event Receive Draw HUD”, SizeX & SizeY this means your screen width and heigh

A example: If I want put a crosshair on the middle of screen and will not be messed by resolution

Do below

Set the texture coordinate = ( ScreenX/2 , ScreenY/2 )

This way is prefect, I try myself. Defeat all resolution

That may work for the center of the screen but If I try to position things elsewhere this happens. When the screen isnt fullscreen, its in the center

11185-hud1.png

If I full screen, its still not setting in the middle of the bar.

11186-hud2.png

Why not let the text be a child?

I mean you set your bar to center by using ScreenSize

Then set the text’s position = barX + barWidth/2 same to Y

All higher layer as a parent (like Hp bar, status info window or skill slot)

The children of those thing are relative to them

I do not know how to make the text a child. I am using the Draw Text node, and the HP bar is a material instance.

Sorry about my confused description. There is not a “Child” option in UE4

I mean a logic.

You set your bar position depend on screen size

Then set your text position depend on bar position like the relationship between bar and screen

promote bar’s position to a variable and use it to define text’s position

Ok that worked. Thanks for the help. I’m going to need more variables now.

I think UMG is the best solution so far. I’m still looking for this same answer :frowning:

Try this link: Wiki

No coding required.