- Home /
Question by
HeliumSpoon · Mar 12, 2017 at 06:14 PM ·
uislider
How do I get the value of a slider?
I am a beginner to Unity. I want to display the current value of a slider as text. I've looked for answers on my own for an hour and can't make it work. It looks like you're supposed to create a public variable like,
public Slider sliderName;
then just use
variable = sliderName.value;
to get the value out. But every time I try that it gives me an error ( 'Slider' does not contain a definition for 'value'). It looks like nobody else is having this problem so I assume I'm doing something stupid. I'm already using UnityEngine.UI so that isn't the problem.
Comment
Answer by Stalex150 · Jan 09, 2018 at 04:18 PM
I had same problem. I made my own empty script named "Slider", it caused than i didn't have "value" property on default Slider class. :)