|
I want to make a slider that has integer values between 0 and 90 inclusive. However, when i run this in my project, the word Angle along with the slider only appear. How can i display the value of the number between 0 and 90 right next to the slider? function OnGUI () { mySlider = LabelSlider (Rect (10, 100, 100, 20), mySlider, 5.0, "Angle"); } function LabelSlider (screenRect : Rect, sliderValue : float, sliderMaxValue : float, labelText : String) : float { GUI.Label (screenRect, labelText); screenRect.x += screenRect.width; // <- Push the Slider to the end of the Label sliderValue = GUI.HorizontalSlider (screenRect, sliderValue, 0.0, sliderMaxValue); return sliderValue; }
(comments are locked)
|
|
mySlider = LabelSlider (Rect (10, 100, 100, 20), mySlider, 5.0, "Angle"); The very last variable is the string you want to display. Replace it by "Angle"+mySlider to add the value of the slider to it. mySlider = LabelSlider (Rect (10, 100, 100, 20), mySlider, 5.0, "Angle "+mySlider);
(comments are locked)
|
