当前位置:网站首页>[unity technology accumulation] simple timer & Co process & delay function
[unity technology accumulation] simple timer & Co process & delay function
2022-07-19 11:40:00 【FYK0q0】
Use the co process to realize a simple timer
public class Timer_Coroutine : MonoBehaviour
{
void Start()
{
StartCoroutine(Timer());
}
int time = 0;
IEnumerator Timer()
{
while (true)
{
time++;
yield return new WaitForSeconds(1);
print(time);
}
}
}

Implement timer with delay function
public class Timer_Delayed : MonoBehaviour
{
int time = 0;
void Start()
{
InvokeRepeating("Timer", 1, 1);
}
private void Timer()
{
time++;
print(time);
}
}

边栏推荐
- Docker安装MySQL
- Play with the one-stop scheme of cann target detection and recognition
- SPI服务发现机制
- Wechat applet cloud development 1 - Database
- A curated list of awesome Qt and QML
- Cmake common commands (V)
- Codeforces - 587e (linear basis + segment tree + difference)
- SQL union operator
- Leetcode 1310. Subarray XOR query
- LeetCode 745. Prefix and suffix search
猜你喜欢

Robot development -- common simulation software tools

Hot discussion: my husband is 34 years old this year and wants to read a doctoral degree. What should I do in the future to do scientific research?
![[untitled] CV learning 1 conversion](/img/22/55d171f49659e704951ebd82a33f06.png)
[untitled] CV learning 1 conversion

466-82(3、146、215)

Un modèle de détection par défaut basé sur le réseau neuronal évolutif rapide dans le contrôle de la qualité des produits - lire les notes
![[multithreading] detailed explanation of JUC (callable interface, renntrantlock, semaphore, countdownlatch), thread safe set interview questions](/img/3a/b0bdf66e11e66234a222d977fd933c.png)
[multithreading] detailed explanation of JUC (callable interface, renntrantlock, semaphore, countdownlatch), thread safe set interview questions

热议:老公今年已经34周岁想读博,以后做科研,怎么办?

The type of MySQL index (single column index, combined index, BTREE index, clustered index, etc.)

Today's sleep quality record 79 points

Tier defect detection using full revolutionary network
随机推荐
解决邮件客户端QQ Mail及Thunderbird无法登入Outlook的问题
At5147-[agc036d]negative cycle [DP, model conversion]
Solve the problem that QQ mail and Thunderbird cannot log in to outlook
TiKV Follower Read
The difference between CPU load and CPU utilization
Docker安装MySQL
Basic operation of tree
Hello JSON Schema
Automated graphical interface library pyautogui
动态内存分配问题
[PostgreSQL] PostgreSQL 15 optimizes distinct
565. Array nesting: regular simulation questions
Unity high version returned low version error
TiFlash 性能调优
TCP congestion control details | 7 Surpass TCP
A curated list of awesome Qt and QML
Qt--优秀开源项目
02-3、指針和引用的區別
开发那些事儿:如何解决RK芯片视频处理编解码耗时很长的问题?
Dream CMS Front Office Search SQL Injection