我正在从Unity的UI转移到NGUI。
以前,我可以使用以下脚本向按钮添加侦听器:
button.GetComponentInChildren<Button>().onClick.AddListener(() =>
{
//codes that could be triggered by click the button.
});但当切换到NGUI时,我不能通过以下方式使其工作:
EventDelegate.Set(go.GetComponent<UIButton>().onClick, OnButtonClickActive);
private void OnButtonClickActive()
{
Debug.Log("active button clicked");
}https://stackoverflow.com/questions/44380573
复制相似问题