using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; namespace SHINT.UI { public class UI_FPSCounter : MonoBehaviour { TextMeshProUGUI counter; float frames = 0f; float timeElap = 0f; float frametime = 0; void Update() { frames++; timeElap += Time.unscaledDeltaTime; //frame time ´õÇϱâ //1Ãʰ£ÀÇ Æò±Õ °ª ³ªÅ¸³»±â if (timeElap > 1f) { frametime = timeElap / (float)frames; timeElap -= 1f; UpdateText(); frames = 0; } } void UpdateText() { counter.text = string.Format( "FPS : {0}, FrameTime : {1:F2} ms", frames, frametime * 1000.0f); } } }