unity Toggle组件添加触发事件回调
public class Demo : MonoBehaviour {
private Toggle toggle;
// Use this for initialization
void Start () {
toggle.onValueChanged.AddListener((bool isOn)=> { OnToggleClick(toggle,isOn); });
}
private void OnToggleClick(Toggle toggle,bool isOn)
{
//TODO
}
}