Last active
August 29, 2015 14:20
-
-
Save aberloni/282d4011da0c6059a2be to your computer and use it in GitHub Desktop.
Tool to warn if fps is under a given value
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 FpsWarning : MonoBehaviour { | |
| int fps = 0; | |
| public int monitorValue = 60; | |
| GUIStyle style; | |
| void OnGUI(){ | |
| fps = Mathf.FloorToInt(1.0f / Time.deltaTime); | |
| if(style == null){ | |
| style = new GUIStyle(); | |
| } | |
| style.normal.textColor = (fps < monitorValue) ? Color.red : Color.white; | |
| GUI.Label(new Rect(10,Screen.height - 30, 100,30), "FPS "+fps, style); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment