1. Button
添加点击事件
using UnityEngine;
using UnityEngine.UI;
public class exp : MonoBehaviour
{
// 在脚本组件处绑定Button
public Button myButton;
void Start()
{
myButton.onClick.AddListener(myButtonOnClick);
}
void myButtonOnClick() {
Debug.Log("按钮被点击!");
}
}
网友评论