public void OnClick()
{
var button = UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject;
print(button.name);
}
将脚本挂在一个物体上,然后button组件设置OnClick()上设置这个函数,打印可以看到button的名字
public void OnClick()
{
var button = UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject;
print(button.name);
}
将脚本挂在一个物体上,然后button组件设置OnClick()上设置这个函数,打印可以看到button的名字