Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

slider.onchanged in unity

//All in one
slider.onValueChanged.addListener(delegate{myFunction(slider.value);});

//Easier to read
ListenSlider(slider, (value) => { myFunction(value); });

public void ListenSlider(Slider slider, Action<float>  onchange )
	{
		slider.onValueChanged.AddListener(delegate{onchange(slider.value);});
	}
 
PREVIOUS NEXT
Tagged: #unity
ADD COMMENT
Topic
Name
5+1 =