In Unity there’s a RangeAttribute that limits an integer or float inside a given range.
[Range(0f, 20f)]public float myFloat = 10f;
The question is, is there a way to get those upper/lower bound via script?
In Unity there’s a RangeAttribute that limits an integer or float inside a given range.
[Range(0f, 20f)]public float myFloat = 10f;
The question is, is there a way to get those upper/lower bound via script?
What does that mean? You want to control the bounds via script?
public float lowerBound = 1f;
public float upperBound = 10f;
public float newNumber;
void Start(){
newNumber = Random.Range(lowerBound, upperBound);
}
Unless you mean you wanted to reverse the process and you want to find the bounds from only a float? Because that’s not only impossible but also illogical.