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
    }
}
posted @ 2022-06-22 18:05  哒哒哒~~~  阅读(126)  评论(0编辑  收藏  举报