How do I take out a UI Slider's value?
I have a slider and I need to display the value as a text over it in the interface. I also need this value because every value is supposed to act as something different. What I have now makes the gameobject appear/disappear with all the values. I need it to appear only when the slider's value is equal to 2. This is what I have now:
var numberOfRooms: UI.Slider; var noRooms: int;
function showHideApartment1(){
apartment1.GetComponent.().enabled = !apartment1.GetComponent.().enabled;
}
get the slider component either using get component or attaching it to script in inspector. and then _slidername.value will get you slider value.
@Umresh I am attaching this script to an empty gameObject, and then adding the function to the inspector in the On Value Changed. The point is that I don't know how to call the slider itself to get the value. Could you write the whole line of code? Thanks a lot