public void OnClick()
{
var button = UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject;
print(button.name);
}
将脚本挂在一个物体上,然后button组件设置OnClick()上设置这个函数,打印可以看到button的名字
unity UGUI 点击button获取button的名字
最新推荐文章于 2023-04-23 23:57:43 发布