Assign min / max values to range in inspector.


I need to assign min / max values to a range in the inspector trough script:

[Range(min, max)] 

I get the error:

An object reference is required to access non-static member `IntInterval.min’

How do you assign values to range in inspector trough script?

You need to make it static. Static variables can be used by all the objects of that class, but exist only once.
It would be helpful to see your code.

I don’t think you are allowed to see static variables in the inspector.

I’m not sure if there’s a way to do it using the [Range(min,max)] tag, but one possibility if you intend on modifying values through the inspector is the use Mathf.Clamp, creating a min and max variable, and then use those variables for the min and max in the Mathf.Clamp function.

This will allow for clamping the top and bottom value of the variable you were going to use Range against originally.