当前位置:网站首页>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);
}
}
边栏推荐
- [cloud native and 5g] micro services support 5g core network
- A5000 vgpu display mode switching
- 腾讯字节等大厂面试真题汇总,网易架构师深入讲解Android开发
- HDU 1026 Ignatius and the Princess I 迷宫范围内的搜索剪枝问题
- 使用ssh连接被拒
- Tencent T3 Daniel will teach you hand-in-hand, the internal information of the factory
- beegfs高可用模式探讨
- POJ1149 PIGS 【最大流量】
- Enumeration gets values based on parameters
- 腾讯字节阿里小米京东大厂Offer拿到手软,老师讲的真棒
猜你喜欢
【GET-4】
Deep learning classification network -- zfnet
[cloud native and 5g] micro services support 5g core network
持续测试(CT)实战经验分享
Classic 100 questions of algorithm interview, the latest career planning of Android programmers
In simple terms, interview surprise Edition
Continuous test (CT) practical experience sharing
Configuration and simple usage of the EXE backdoor generation tool quasar
【计网】第三章 数据链路层(3)信道划分介质访问控制
枚举根据参数获取值
随机推荐
A5000 vgpu display mode switching
Finally, there is no need to change a line of code! Shardingsphere native driver comes out
PowerPivot——DAX(初识)
Case ① | host security construction: best practice of 3 levels and 11 capabilities
Vscode debug run fluent message: there is no extension for debugging yaml. Should we find yaml extensions in the market?
Appx code signing Guide
句号压缩过滤器
logstash高速入口
The "white paper on the panorama of the digital economy" has been released with great emphasis on the digitalization of insurance
Groovy basic syntax collation
String长度限制?
Introduction of Xia Zhigang
Tencent T3 teaches you hand in hand. It's really delicious
系统与应用监控的思路和方法
腾讯T4架构师,android面试基础
Poj3617 best cow line
Technology sharing | packet capturing analysis TCP protocol
Crawler (14) - scrape redis distributed crawler (1) | detailed explanation
[cloud native and 5g] micro services support 5g core network
Anaconda安裝後Jupyter launch 沒反應&網頁打開運行沒執行