unity——CalculateFPS

CalculateFPS

	void CalculateFPS()
	{
		timeleft -= Time.deltaTime;
		accum += Time.timeScale / Time.deltaTime;
		++frames;
		// Interval ended - update GUI text and start new interval
		if (timeleft <= 0.0)
		{
			// display two fractional digits (f2 format)
			float fps = accum / frames;
			string format = System.String.Format("{0:F2} FPS", fps);
			fpsText = format;
			timeleft = updateInterval;
			accum = 0.0F;
			frames = 0;
		}
	}

 

上一篇:交互式甘特图控件,教你如何使用日历!


下一篇:dfs序 线段树