Creating "HUD Scaling" Accessibility Feature

Hello all,

I’m a little stuck with regards to the above. I want to create an accessibility feature where-by the player can increase the value in a progress bar, save the options and that value is then used to scale the HUD elements.

Progress bar/options are fine, I can do that, but I’m uncertain as how to approach the scaling via UMG and Blueprint?

As a scenario…

Default opton set to 100%, player slides the progress bar to 125%. When the game is now run, each UI element in the HUD is 25% larger, scaling out from their anchor points etc.

Can someone give me a “start here” kinda thing?

Thanks in advance :slight_smile:

Hey, if you want to scale all UI, you can do something like this:

if (UUserInterfaceSettings* UISettings = GetMutableDefault<UUserInterfaceSettings>())
{
    UISettings->ApplicationScale = Scale;
}

If you want to do it locally only for your HUD, maybe you can wrap it in a Scale Box, and set its scale?

image

2 Likes

Hi @KristofMorva, thanks for such a prompt reply!

I should have mentioned I was doing this in BP, sorry… so thanks for the node etc…

With the “wrapping it in a scale box” approach, presumably I’d need to wrap each element in a separate scale box, and then tell each one to change? Rather than one big scale box which everything else lives inside?

e.g. Player Health (inside a scale box) / Player Lives (inside a scale box) etc etc… ?

I assume if everything was in one box, they might go “off the page” so to speak? or, does the use of the scale box still respect the individual elements anchor points (which would be sweet!)

Thanks again :slight_smile:

As far as I remember, Scale Box will handle it well, you don’t need to wrap them one-by-one. My memory is a bit faded tho, but you can try it out very easily, just Wrap With -> Scale Box, and set a user scale of 1.25 :slight_smile:

1 Like

I did give it a whirl, and it worked nicely. I did just wrap the one widget named slot in it though. It states that it can only have one child, so not quite sure what would happen if I put everything in a canvas panel, and then put that in the scale box, will try a little later. But worst case, of I had to wrap each one, it’s not the end of the world, just means managing the messages a bit differently. I will experiment!

Thanks again for your help. :slight_smile: