📜  slider.onchanged in unity - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:16.755000             🧑  作者: Mango

代码示例1
//All in one
slider.onValueChanged.addListener(delegate{myFunction(slider.value);});

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

public void ListenSlider(Slider slider, Action  onchange )
    {
        slider.onValueChanged.AddListener(delegate{onchange(slider.value);});
    }