Answers for "slider.onchanged in unity"

C#
0

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);});
	}
Posted by: Guest on August-28-2021

C# Answers by Framework

Browse Popular Code Answers by Language