NGUI 添加回调函数

//缓动完成
TweenPosition tweenPos=GetComponent<TweenPosition>();
tweenPos.AddOnFinished(complete);

//按钮按下
UIButton btn=GetComponent<UIButton>();
btn.onClick.Add(new EventDelegate(click));

void click(){
    Debug.Log("click");   
}

void complete(){
    Debug.Log("tweenPosition complete");
}

 2.手动给uiButton中的OnClik Notify添加,如图

这种方式接收的是一个GameObject,GameObject里绑定有公开方法的脚本,可选择任意一个公开方法做为回调。

3.直接绑定脚本,脚本里带OnClick函数

原文地址:https://www.cnblogs.com/kingBook/p/5284401.html