public Text fpsText;
float time;
int frameCount;
// Update is called once per frame
void Update()
{
time += Time.unscaledDeltaTime;
frameCount++;
if (time >= 1 && frameCount >= 1)
{
float fps = frameCount / time;
time = 0;
frameCount = 0;
fpsText.text = fps.ToString("f2");
}
}