|
I have a metronome controlled by a GUI slider in my game. I have then displayed the value of the slider variable using GUI.Label. This works great, only the variable often has way to many decimals (i want it to have none). So obscure values come up for the value. Is there a way to preferably create a "snap to" GUI slider or just limit the no. of decimals to be displayed on the label? Any help will be greatly appreciated. Oh and I used variable.ToString() for displaying the variable in the GUI.
(comments are locked)
|
will specify 0 decimal places or the string (F2 will be 2 decimal places, etc. in case you ever need to do that) To answer your comment - if you want it to snap to every 5, in your specific case: c#
js
Should do it Thankyou, i was wondering what the parentheses were for...
Sep 07 '10 at 09:27 PM
Will 7
I just noticed that sometimes values such as 153 come up and then the next value down may be 148 (or alike). So 150 (for instance) as a metronome speed is unobtainable. Would there be anyway to as i mentioned create a "snap-to" GUI Slider. But this should be sufficient for now.
Sep 07 '10 at 09:34 PM
Will 7
Added some basic code for snapping to increments of 5
Sep 07 '10 at 10:21 PM
Mike 3
Thanks for the reply, but which variables do I swap the "variable" and "temp" with? Do I put it in "function Update () {}"?
Sep 10 '10 at 02:47 PM
Will 7
All i can see it doing is removing 3 from "variable"?
Sep 10 '10 at 02:48 PM
Will 7
(comments are locked)
|
