博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
unity UGUI 点击button获取button的名字
阅读量:318 次
发布时间:2019-03-04

本文共 186 字,大约阅读时间需要 1 分钟。

 

public void OnClick()

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

转载地址:http://qusq.baihongyu.com/

你可能感兴趣的文章