- Home /
How to create a slider in-script?
Dumb question, but I couldn't find the answer anywhere...
My question is how do you create a slider that shows an int value in the script itself, something like :
I tried searching the "Slider"(In-built) script for this, but it was really hard to find anything in it...
sliderref.png
(9.4 kB)
Comment
Best Answer
Answer by Shrimpey · May 27 at 02:09 PM
You just need to use the Range attribute:
[Range(0, 1)]
float sampleVariable;
More info can be found here: https://docs.unity3d.com/ScriptReference/RangeAttribute.html
Oh...That was so much more simple than I expected, Thanks a lot!