当前位置:网站首页>Unity writes a timer tool to start timing from the whole point. The format is: 00:00:00
Unity writes a timer tool to start timing from the whole point. The format is: 00:00:00
2022-07-06 20:13:00 【LiPing122335】
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class jishi : MonoBehaviour {
private float timer = 0f;
private int h = 0;
private int m = 0;
private int s = 0;
private string timeStr = string.Empty;
void Update()
{
timer += Time.deltaTime;
if (timer >= 1f) { s++; timer = 0; }
if (s >= 60) { m++; s = 0; }
if (m >= 60) { h++; m = 0; }
if (h >= 99) { h = 0; }
}
void OnGUI()
{
timeStr = string.Format("{0:D2}:{1:D2}:{2:D2}", h, m, s);
GUI.Label(new Rect(10, 10, 100, 200), timeStr);
}
}
边栏推荐
- 5. Nano - Net in wireless body: Top 10 "is it possible?" Questions
- Tips for web development: skillfully use ThreadLocal to avoid layer by layer value transmission
- HDU 1026 Ignatius and the Princess I 迷宫范围内的搜索剪枝问题
- Node.js: express + MySQL实现注册登录,身份认证
- 01 基础入门-概念名词
- Classic 100 questions of algorithm interview, the latest career planning of Android programmers
- Tencent T4 architect, Android interview Foundation
- rt-thread i2c 使用教程
- Logstash expressway entrance
- mod_wsgi + pymssql通路SQL Server座
猜你喜欢
腾讯T3大牛手把手教你,大厂内部资料
Anaconda安装后Jupyter launch 没反应&网页打开运行没执行
语音识别(ASR)论文优选:全球最大的中英混合开源数据TALCS: An Open-Source Mandarin-English Code-Switching Corpus and a Speech
数字三角形模型 AcWing 1018. 最低通行费
Oceanbase Community Edition OBD mode deployment mode stand-alone installation
[network planning] Chapter 3 data link layer (4) LAN, Ethernet, WLAN, VLAN
Discussion on beegfs high availability mode
An East SMS login resurrection installation and deployment tutorial
After solving 2961 user feedback, I made such a change
Transformer model (pytorch code explanation)
随机推荐
Enumeration gets values based on parameters
8086指令码汇总表(表格)
Information System Project Manager - Chapter VIII project quality management
PowerPivot——DAX(初识)
Appx代码签名指南
微信小程序常用集合
Digital triangle model acwing 1018 Minimum toll
[network planning] Chapter 3 data link layer (4) LAN, Ethernet, WLAN, VLAN
Synchronization of data create trigger synchronization table for each site
青龙面板白屏一键修复
数据的同步为每个站点创建触发器同步表
Notes on beagleboneblack
持续测试(CT)实战经验分享
Standardized QCI characteristics
RT thread I2C tutorial
Classic 100 questions of algorithm interview, the latest career planning of Android programmers
js获取浏览器系统语言
Configuration and simple usage of the EXE backdoor generation tool quasar
A5000 vgpu display mode switching
JVM_常见【面试题】