Skip to content

Instantly share code, notes, and snippets.

@aberloni
Last active August 29, 2015 14:20
Show Gist options
  • Select an option

  • Save aberloni/282d4011da0c6059a2be to your computer and use it in GitHub Desktop.

Select an option

Save aberloni/282d4011da0c6059a2be to your computer and use it in GitHub Desktop.
Tool to warn if fps is under a given value
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