All pastes #2076208 Raw Edit

Something

public text v1 · immutable
#2076208 ·published 2011-06-07 14:57 UTC
rendered paste body
using UnityEngine;
using System.Collections;

public class FPSdisplay : MonoBehaviour {
	
	float updatePeriod = 0.5f;
	float nextUpdate = 0.0f;
	float frames = 0.0f;
	float fps = 0.0f;
	
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		frames++;
   
		if(Time.time > nextUpdate){
      
			fps = Mathf.Round(frames / updatePeriod);
			guiText.text = "Frames Per Second: " + fps;
			nextUpdate = Time.time + updatePeriod;
			frames = 0;      
		}
	}
}