[UMG] How can I set a slider's value range to be, for example, 70-100 instead of 0.0-1.0?

I’m asking this because I’m making an FOV slider for my game. Currently it works, but it’s literally setting my FOV to 0-1, and of course that’s not conducive to gameplay at all. Apparently the UMG slider’s value can only go between 0 and 1, so I don’t know how to convert it to a new, arbitrary range. I’ve heard that the Map Range node can help me but I’ve tried it and it seemed to make things worse no matter where I stuck it in the blueprint. Here are what my blueprint graphs currently look like:

Event Graph

Custom Field Of View event

Just take the value of the UMG slider and multiply it by the range (so if it’s 70-100, multiply it by 30) then add the minimum FOV (in your case 70).

So if the slider value is 0 then it will be 0*30+70, which is 70.

If the slider is 1 then it will be 1*30+70, which is 100.

Anything in between will work accordingly.

That works! But now the slider nub is missing. I can still manipulate the slider with the drag motion though. Any idea what’s going on here?

Beats me unfortunately. Haven’t been using UMG that much myself yet :stuck_out_tongue:

Ah, that’s alright. Maybe I can use a progress bar instead. Thanks for the help!

Can it be missing because it is out of bounds? The operating value of the slider is still 0-1. Even if you use lonerider543 way to read the value from 70 to 100, you still have to set the slider value to between 0 and 1.

I’m not sure how to do that, honestly.

In the first picture you posted you set the variable FOVSlider . Is that variable bound to the value of the slider itself or something? What exactly is that variable for?

In my color picker, i made three sliders ranging from 0 to 255.
To do that, i kept the slider range from 0 to 1 (has there is no other thing to do), but made a simple math.
My “Desired Range” is so 0-255 on a 0-1 slider, so i made “Slider value * 255” and with my controller, i can increase or decrease my slider value by doing “Get Slider value + or - (1/255)” so everytime i press the button it increase by one, and the text displays from 0 to 255 but the slider remains 0-1

I made a really helpful spreadsheet that allows you to select a min and max range (for example, I wanted the range for the r.ScreenPercentage settings to be 25-100). I then set the amount I want the slider to increment by (in this case I wanted the value to increment by 25) or the amount of increments that I want (incrementing by 25 will give me 3 increments, not including the min), this returns the amount of increments (3) or the increment value (25). I then took the value of the slider, multiplied that by the number of increments (not the increment amount), used the ROUND node to round to the nearest whole number integer, then multiplied that by the increment amount. This will give you a range of 0-75. Since I wanted my minimum value to be 25 instead of 0, I simply added 25 to the final result, giving me a new range of 0-100.

In order to get the slider to “step” to each increment, I created a second variable (float) for the slider value and took the integer output from the ROUND node, converted it to a float and divided by the amount of increments. Then in the slider settings in UMG, I binded the value under Appearance to this variable.

Unfortunately, I can’t upload the .xlsx file, but if you would like I can copy/paste all of the information for each of the cells. I’ve included screen grabs of each of the elements that I referenced above.

Hope this helps!

Hey man, did you saw this Post?

Furroy posted something helped me out and worked fine. Hope it helps you aswell.

My suggestion would be to get the bind via a function that casts the player and gets the property, but before reaching the return node, divide the variable by it’s max. This will round it from 0-1, which will make it smooth and functional, as long as you have a float. Otherwise, I suggest you try to always use floats in replacement of integers, especially for UI functions.

Sincerely - Goop

Its best to use the the map range node:

the input would be the slider value (bind on change value)
In range A is 0.0
In range B is 1.0
Out range A (the minimum value for the range your variable is using → in your case 70)
Out range B (the maximu value for the range your variable is using → in your case 100)

the Return value is then plugged into round for converting it back to integer

The simplest and fastest solution is to use the Lerp node.

1) When “On Slider Value Change”, plug the value that is coming from the slider to the “alpha” of the Lerp node.

2) Then, you can freely set between the minimum and maximum value you want to limit for the actual return value from the sliders.

3) So, in “alpha” the value of the slider between 0 to 1 represents the percentage from 0% to 100%, hence returning the intended value.

4) Example: At alpha 0, you can set the minimum return value to be 50 on resolution quality. At alpha 1, you can set the maximum return value to be 80 on resolution quality.

just use “map range clamped” node