﻿using UnityEngine;
using System.Collections;

public sealed class HUD : MonoBehaviour {
	private int frameCount = 0;
	private float dt = 0.0F;
	private float fps = 0.0F;
	private float updateRate = 4.0F;

	void Start () {

	}

	void Update () {
		frameCount++;
		dt += Time.deltaTime;
		if (dt > 1.0F / updateRate) {
			fps = frameCount / dt ;
			frameCount = 0;
			dt -= 1.0F / updateRate;
		}
	}

	void OnGUI () {
		GUI.Label(new Rect(10, 10, 150, 100), "Current FPS: " + ((int)fps).ToString());
		GUI.Box(new Rect(Screen.width / 2, Screen.height / 2, 0, 0), "This is a crosshair");
	}
}

﻿using UnityEngine;
using System.Collections;

public sealed class HUD : MonoBehaviour {
	private int FrameCount = 0;
	private float DeltaTime = 0.0F;
	private float FPS = 0.0F;
	private float UpdateRate = 5.0F;

	void Start () {

	}

	void Update () {
		FrameCount++;
		DeltaTime += Time.deltaTime;
		if (DeltaTime > 1.0F / UpdateRate) {
			FPS = FrameCount / DeltaTime ;
			FrameCount = 0;
			DeltaTime -= 1.0F / UpdateRate;
		}
	}

	void OnGUI () {
		GUI.Label(new Rect(10, 10, 150, 100), "Current FPS: " + ((int)FPS).ToString());
		GUI.Box(new Rect(Screen.width / 2, Screen.height / 2, 0, 0), "This is a crosshair");
	}
}

Change some some syntax conventions.
Change some some syntax conventions.
