using UnityEngine; public class FPSTester : MonoBehaviour { private float fpsOutputTime; private float frameCount; private float fps; private float tempDT; private Rect fpsGuiRect = new Rect(Screen.width / 50, Screen.height / 50, 100, 100); void Update() { frameCount++; tempDT = Time.realtimeSinceStartup - fpsOutputTime; if (tempDT >= 1) { fpsOutputTime = Time.realtimeSinceStartup; fps = Mathf.FloorToInt(frameCount / tempDT); frameCount = 0; } } void OnGUI() { GUI.Label(fpsGuiRect, "FPS: " + fps); } }