当前位置:网站首页>How unity runs code every few frames
How unity runs code every few frames
2022-06-24 05:09:00 【LittleU】
Actually in unity in , There is a method to record the number of frames the game is running , Why should I do a function that runs a certain code every few frames ? as a result of , If in update Running in is a waste of resources , Put it in FixedUpdate Run in , Then we need to modify step time, But elsewhere fixedUpdate It's changed , So I want to solve this problem by running a code block every few frames , But it took a long time , They teach you how to look at the frame number , therefore , I went to look through API manual , Finally found a way , This method records the number of frames the game runs from the beginning of the game . Until the game completely exits .
Time.frameCount
This method returns a int Type of shaping , The function prototype is as follows :
public static int frameCount { get; }So I can pass every 5 Frame to run a piece of code :
if (Time.frameCount % 5 == 0)
{
// Executed code ...
}边栏推荐
- 3 minutes to understand JSON schema
- Eigen eigenMatrix
- Pg-pool-ii read / write separation experience
- Three methods of local storage
- Data acquisition gateway intelligent industrial Internet of things
- How does the mobile phone remotely connect to the ECS? What should be paid attention to during the operation
- What is stored in the domain name server? How does the domain name server provide services?
- Bi-sql - Select
- Fluent version control FVM
- How to change the IP address of ECS? What are the precautions for changing the IP address
猜你喜欢

Are you ready for the exam preparation strategy of level II cost engineer in 2022?

Introduction to the "penetration foundation" cobalt strike Foundation_ Cobalt strike linkage msfconsole

Popularization of children's programming education in specific scenarios
![[leetcode daily question] push domino](/img/81/1c31e97d9a245816514bcf47c92107.jpg)
[leetcode daily question] push domino

CTF learning notes 17:iwesec file upload vulnerability-02 file name filtering bypass

Leetcode (question 2) - adding two numbers

SAP mts/ato/mto/eto topic 7: ATO mode 1 m+m mode strategy 82 (6892)

Facebook internal announcement: instant messaging will be re integrated

What are the disadvantages of the free IP address replacement tool?

Leetcode (question 1) - sum of two numbers
随机推荐
Tencent conference rest API x-tc-registered parameter policy update notification
What are the disadvantages of the free IP address replacement tool?
Webmeng: create a website you are proud of
Leetcode (question 1) - sum of two numbers
Analysis of PHP environment configuration
NAT
Detailed explanation of the process after the browser enters the domain name and web address
The conference assistant hidden in wechat is the best way to work efficiently!
Is it useful to build an industrial knowledge map platform?
Pgbouncer lightweight PG connection pool management tool
Cos+cdn realizes the distribution of game client version files in a faster, better and cheaper manner
Is there a free ECS? What should I pay attention to when I rent a server
解析后人类时代类人机器人的优越性
问题:sql创建存储过程
How to change the IP address of ECS? What are the precautions for changing the IP address
What is the domain name of the website? How much is a domain name
让孩子们学习Steam 教育的应用精髓
Functional advantages of industrial wireless router
Spirit breath development log (16)
Critical service failed