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);});
}