当前位置:网站首页>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);
}
}
边栏推荐
- What happened to the kernel after malloc() was transferred? Attached malloc () and free () implementation source
- 青龙面板白屏一键修复
- Oceanbase Community Edition OBD mode deployment mode stand-alone installation
- Tencent byte Alibaba Xiaomi jd.com offer got a soft hand, and the teacher said it was great
- PHP and excel phpexcel
- Synchronization of data create trigger synchronization table for each site
- Case ① | host security construction: best practice of 3 levels and 11 capabilities
- Is it difficult for small and micro enterprises to make accounts? Smart accounting gadget quick to use
- [network planning] Chapter 3 data link layer (3) channel division medium access control
- Selenium advanced operations
猜你喜欢
![[calculating emotion and thought] floor sweeper, typist, information panic and Oppenheimer](/img/8c/afb90128e7a523bbee4c6c4166363f.png)
[calculating emotion and thought] floor sweeper, typist, information panic and Oppenheimer

Standardized QCI characteristics

A5000 vgpu display mode switching

An East SMS login resurrection installation and deployment tutorial

New generation garbage collector ZGC

2022年6月语音合成(TTS)和语音识别(ASR)论文月报

腾讯T3大牛手把手教你,大厂内部资料

【计网】第三章 数据链路层(4)局域网、以太网、无线局域网、VLAN
Tencent T2 Daniel explained in person and doubled his job hopping salary

Case ① | host security construction: best practice of 3 levels and 11 capabilities
随机推荐
Le lancement du jupyter ne répond pas après l'installation d'Anaconda
青龙面板白屏一键修复
[cloud native and 5g] micro services support 5g core network
夏志刚介绍
Is it difficult for small and micro enterprises to make accounts? Smart accounting gadget quick to use
5. Wireless in vivo nano network: top ten "feasible?" problem
mod_wsgi + pymssql通路SQL Server座
A5000 vgpu display mode switching
腾讯T3大牛手把手教你,大厂内部资料
Database specific interpretation of paradigm
PowerPivot——DAX(初识)
Appx code signing Guide
【GET-4】
8086 instruction code summary (table)
广州首个数据安全峰会将在白云区开幕
It's enough to read this article to analyze the principle in depth
In simple terms, interview surprise Edition
How to handle the timeout of golang
An East SMS login resurrection installation and deployment tutorial
Groovy basic syntax collation