GUI.HorizontalSlider precision

Can HorizontalSlider be configured to only slide through whole numbers, 1, 2, 3, 4, 5... and not decimals, 0, 2.631579, 5.233158...

Thank you.

in c#

public class sliderExample: MonoBehaviour{

float repairOmeter = 0.0f;

  void OnGUI(){
    GUI.Label(new Rect(10,20,100,20),"Repair Meter Over Time");
    repairOmeter = GUI.HorizontalSlider(new Rect(25, 45, 100, 30), repairOmeter, 0.0F, 10.0F);
    repairOmeter = (int)repairOmeter;//only for Int

hope this helps :), I guess this is exactly what you need :stuck_out_tongue:

Here it is, I think. I had the var holding the slider value set as a float, when changed to int. All is well.

Any one know why some times when you paste code into this text box after pressing 101010 it doesn't format it right? See example below.

var velMagnitude: int = 0;

function OnGUI () { 
    // Initial Velocity
    GUI.Label(Rect(3,300,200,50), "Initial Velocity");
    velMagnitude = GUI.HorizontalSlider(Rect(3,320,200,20),velMagnitude,0,500);
    GUI.Label(Rect(220,320,50,20), velMagnitude.ToString());

Instead of casting float to int, I would rather suggest to use Mathf.Round(). In most cases it will slip snap the slider to a position closer to mouse cursor.
Eg: 3.9 will be snapped to 4 instead of 3.

void OnGUI(){
   value = GUI.HorizontalSlider(new Rect(...), repairOmeter, 0.0f, 10.0f);
   value = Mathf.Round(value);