//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);});
}
//A place to store it
float currentMaxV;
//Set it
currentMaxV = sliderX.maxValue;
//Detect it
if(sliderX.maxValue > currentMaxV)
{
//Slider max value changed
currentMaxV = sliderX.maxValue;
}