当前位置:网站首页>Unity prevents the BTN button from being clicked continuously
Unity prevents the BTN button from being clicked continuously
2022-06-22 14:28:00 【Cangwolf King unity College】
public class MyButton : MonoBehaviour
{
public bool isClick;// Do you want to click
public float tempTime = 0;// timer
public Button Btn;// Button
void Awake()
{
Btn.onClick.AddListener(OnClick);// Register button event
}
void Update()
{
if (isClick)// If clicked
{
tempTime+= Time.deltaTime;
if (tempTime> 2)
{
tempTime= 0;
Btn.enable = true;
isClick = false;
}
}
}
private void OnClick()
{
isClick = true;
Btn.enable= false;
}
}
边栏推荐
- 坚持了 10 年的 9 个编程好习惯
- What you must understand before you are 30
- 基于SSH框架甜品商城管理系统【源码+数据库】
- Transformers vit image model vector acquisition
- Messiari annual report-2021
- unity的富文本Text的Color设置颜色全透明
- Seven cattle cloud upload picture
- In 5g era, how to create an amazing live VR activity?
- VR panoramic shooting breaks the deadlock of traditional propaganda that wild geese pass without leaving traces
- How do I open an account on my mobile phone? Is it safe to open an account online?
猜你喜欢

CVE-2022-22965複現

Nine good programming habits for 10 years

"Dare not doubt the code, but have to doubt the code" a network request timeout analysis

能让Jellyfin直接挂载阿里云盘的aliyundrive-fuse

Traffic replication in istio Service Grid

程序员要不要选择软件人才外包公司?

Database employment consulting system for your help

如何实现接口异常场景测试?测试方法探索与测试工具实现

Stop using system Currenttimemillis() takes too long to count. It's too low. Stopwatch is easy to use!

HMS core news industry solution: let technology add humanistic temperature
随机推荐
基于SSH框架甜品商城管理系统【源码+数据库】
Nansen Annual Report
As a passer-by, some advice for programmers who are new to the workplace
What is bout?
史蒂芬·柯维写给年轻人的高效工作秘笈
VCIP2021:利用解码信息进行超分辨率
Implementation of redis+caffeine two-level cache
安装和使用protobuf-c
Cve-2022-22965 reappearance
d的破坏与安全
Do you know the scope and process of software project acceptance testing?
Stm32f1 and stm32subeide programming example - Optical intermittent sensor drive
Screenshot of the uniapp app and save it locally
Chip silicon and streaming technology
uniapp app 端截屏且保存到本地
JS高级程序设计第 4 版:迭代器的学习
If you want to know the stock account opening discount link, how do you know? Is it safe to open an account online?
Simple integration of client go gin IX create
BSN发展联盟理事长单志广:DDC可为中国元宇宙产业发展提供底层支撑
Transformers vit image model vector acquisition