How can "bounds" for script variables be defined for use in the Inspector?

Is there a way to enforce value boundaries for variables exposed to the Inspector?

Many of the built-in components have ranges to constrain script variables, but I’ve thus far been unable to find it in any of the documentation.

The main purpose of this is to be able to “scrum” the values during testing without them crossing some set boundary.

This answer is first in google. But it’s a little outdated.
Now solution is simple as this:

[Range(0.0f,1.0f)]
public float MyVariable = 1.0f;

Unity Scripting reference

You have to use a custom inspector for this. Here’s an example I made a while ago.