If I add a function from a script to the OnValueChanged part of a slider, and the function takes a float parameter, can I use the Value (from 0 to 1) parameter of the slider in that function? In other words, 1) is there a way to access that property in the code (meaning I don’t need a parameter), or 2) is there a way to sort of drag and drop the Value property to the parameter slot so the parameter reads the value rather than a number I type in?
Try this: (Javascript)
var volume : float = 0.3f; // set this to whatever default volume you want
public function VolumeSlider (value : float){
volume = AudioListener.volume = value; // this changes the volume
}
and then when assigning the function to the slider from the dropdown, instead of using “VolumeSlider(float)”, use the one called “VolumeSlider” (may be towards the top of the list).