Button-Script
private Button ddButton;
this.ddButton = transform.Find("Button-dd").GetComponent<Button>();

public void OnDdPressEvent() {
        Debug.Log("hello button");
        this.ddButton.gameObject.transform.Find("Text").GetComponent<Text>().text = "我被修改饿了";
}
this.ddButton.onClick.AddListener(OnDdPressEvent);

通过脚本添加事件监听。


首页 我的博客
粤ICP备17103704号