FpsDisplay.cs
416 Bytes
using UnityEngine;
using UnityEngine.UI;
public class FpsDisplay : MonoBehaviour
{
private int _avgFramerate;
private Text _t;
private void Start()
{
_t = GetComponent<Text>();
}
public void Update()
{
float current = 0;
current = Time.frameCount / Time.time;
_avgFramerate = (int)current;
_t.text = _avgFramerate.ToString() + " FPS";
}
}