public class FPS : MonoBehaviour
{
public float FPSCount;
public bool _isShow = true;
IEnumerator Start()
{
//GUI.depth = 2;
while (true)
{
if (Time.timeScale == 1)
{
yield return new WaitForSeconds(0.1f);
FPSCount = Mathf.Round(1 / Time.deltaTime);
}
else
{
FPSCount = 0;
}
yield return new WaitForSeconds(0.5f);
}
}
private void OnGUI()
{
if(_isShow)
GUI.Label(new Rect(Screen.width-50, Screen.height - 50, 100, 100), FPSCount.ToString());
}
}