c-sharp
Framerate in Unity
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class frameRate : MonoBehaviour {
public Text fpsText;
public float deltaTime;
void Update () {
deltaTime += (Time.deltaTime - deltaTime) * 0.1f;
float fps = 1.0f / deltaTime;
fpsText.text = Mathf.Ceil (fps).ToString ();
}
}
Was this helpful?
Similar Posts