These drawers are quite useful when working with numerical ranges and precision. On the one hand, we have the PowerSlider, which allows us to generate a non-linear slider with curve control.
Its syntax is as follows:
[PowerSlider(3.0)] _PropertyName ("Display name", Range (0.01, 1)) = 0.08
On the other hand, we have the IntRange which, as its name says, adds a numerical range of integer values.
Its syntax is as follows:
[IntRange] _PropertyName ("Display name", Range (0, 255)) = 100
Note that, if we want to use these properties within our shader, they have to be declared within the CGPROGRAM in the same way as a conventional property. To understand how to use it, we will do the following operation:
Shader “InspectorPath / shaderName”
{
Properties
{
// declare drawer
[PowerSlider(3.0)]
_Brightness (“Brightness", Range (0.01, 1)) = 0.08
[IntRange]
_Samples ("Samples", Range (0, 255)) = 100
}
SubShader
{
Pass
{
CGPROGRAM
...
// generate connection variables
float _Brightness;
int _Samples;
...
ENDCG
}
}
}
In the example above, we declare a PowerSlider called _Brightness and an IntRange called _Samples. Finally, using the same names, we generate our connection variables within the CGPROGRAM.