I’m wanting to limit the maximum and minimum number in an input field but I don’t know how to do this. How can I do this?
Thank you for any and all help.
I’m wanting to limit the maximum and minimum number in an input field but I don’t know how to do this. How can I do this?
Thank you for any and all help.
Do you mean Mathf.Clamp?
Here is an example,
float Min;
float Max;
float NumberToClamp;
void Update() {
NumberToClamp = Mathf.Clamp(NumberToClamp, Min, Max)
}
This will tell unity, NumberToClamp is equal to NumberToClamp, and should not go below Min, or above Max.
Input the variables/numbers you need and this should work.