- Home /
Question by
partoAraGamers · Sep 17, 2017 at 06:06 AM ·
c#unity 5script.unity5
How to define a slider on script file?
Hi....
I want a slider like what is in the image below on my script file:
how can i make that?!
mysome.png
(1.9 kB)
Comment
[Range(1, 10)]
public float Color$$anonymous$$ultiplier = 1.0f;
Best Answer
Answer by Arocide · Sep 17, 2017 at 07:23 AM
This can be accomplished for individual fields by adding the Range Attribute
To show what is in your example when you created your public field place the Range
Attribute above it like this:
[Range(1, 10)]
public float colourMultiplier;
This will cause the editor to instead show a slider in the inspector you can drag around between the two values (In this case between 1 and 10 including 1 and 10).
is there a way to create a line to separate some variables from each other in script file?
Yes, [Header("$$anonymous$$y Header")]
and [Space(5)]
attribute