-
-
Save birdinforest/9e43fed776459695c02a to your computer and use it in GitHub Desktop.
Show Fps.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class Fps : MonoBehaviour { | |
string label = ""; | |
float count; | |
IEnumerator Start () | |
{ | |
GUI.depth = 2; | |
while (true) { | |
if (Time.timeScale == 1) { | |
yield return new WaitForSeconds (0.1f); | |
count = (1 / Time.deltaTime); | |
label = "FPS :" + (Mathf.Round (count)); | |
} else { | |
label = "Pause"; | |
} | |
yield return new WaitForSeconds (0.5f); | |
} | |
} | |
void OnGUI () | |
{ | |
GUI.Label (new Rect (5, 40, 100, 25), label); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment