当前位置:网站首页>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);
}
}
边栏推荐
- 02 基础入门-数据包拓展
- The "white paper on the panorama of the digital economy" has been released with great emphasis on the digitalization of insurance
- 【GET-4】
- 永磁同步电机转子位置估算专题 —— 基波模型与转子位置角
- Case ① | host security construction: best practice of 3 levels and 11 capabilities
- Problems encountered in using RT thread component fish
- 【云原生与5G】微服务加持5G核心网
- Introduction to enterprise lean management system
- Standardized QCI characteristics
- JS get browser system language
猜你喜欢
Cesium 点击绘制圆形(动态绘制圆形)
Jupyter launch didn't respond after Anaconda was installed & the web page was opened and ran without execution
Enumeration gets values based on parameters
Information System Project Manager - Chapter VIII project quality management
Redisson bug analysis
BUUCTF---Reverse---easyre
Node. Js: express + MySQL realizes registration, login and identity authentication
Configuration and simple usage of the EXE backdoor generation tool quasar
腾讯安卓开发面试,android开发的基础知识
Continuous test (CT) practical experience sharing
随机推荐
Transformer model (pytorch code explanation)
5. 无线体内纳米网:十大“可行吗?”问题
What happened to the kernel after malloc() was transferred? Attached malloc () and free () implementation source
Speech recognition (ASR) paper selection: talcs: an open source Mandarin English code switching corps and a speech
方法关键字Deprecated,ExternalProcName,Final,ForceGenerate
8086指令码汇总表(表格)
JS get browser system language
Wonderful coding [hexadecimal conversion]
Poj3617 best cow line
广州首个数据安全峰会将在白云区开幕
logstash高速入口
5. Wireless in vivo nano network: top ten "feasible?" problem
Standardized QCI characteristics
In simple terms, interview surprise Edition
句号压缩过滤器
Information System Project Manager - Chapter VIII project quality management
Tips for web development: skillfully use ThreadLocal to avoid layer by layer value transmission
B-杰哥的树(状压树形dp)
Groovy basic syntax collation
AsyncHandler