using UnityEngine;
/// <summary>
/// 一秒钟内Update函数执行了多少帧
/// </summary>
public class Test001 : MonoBehaviour
{
bool isStart = false;
/// <summary>
/// 累计帧率
/// </summary>
public int updateCount = 0;
public float m_timer = 0;
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Mouse0))//检测鼠标左键按下 Input.GetKeyDown();按住时只会在按下的瞬间返回真,而剩余的时间即使我们长按,它也不会继续返回,直到我们抬起按键,并重新按下时,才返回真
{
isStart = true;
updateCount = 0;
m_timer = 0;
}
if(isStart)
{
updateCount++;
m_timer += Time.deltaTime;
if(m_timer >=1) // 计时器累计时间等于一秒钟时停止计时.
{
isStart = false;
}
}
}
}
unity3d 一秒钟内Update函数执行了多少帧
猜你喜欢
转载自blog.csdn.net/u013628121/article/details/127972417
今日推荐
周排行