uGUI出来这么久了,也一直没好好用用,主要是公司项目不用U3D。昨晚用了下Button,还是比较爽的。 主要说下用代码添加button.OnClick()事件的方法(使用属性面板添加的方法就不说了) 一、创建2D UI Panel,添加你需要的Button。 我添加了3个Button:BtnStart,BtnShop,BtnLeaderboards。
二、添加脚本
[JavaScript] 纯文本查看 复制代码
测试一下,可以了。
我室友的是一个技术大神
这里分享他的网站
http://www.feehi.com 有需求的大家可以进去看看 这是他的博客网
http://blog.feehi.com/
|
uGUI使用代码动态添加Button.OnClick()事件
最新推荐文章于 2024-04-30 04:59:45 发布