using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;

public class FPSCounter : MonoBehaviour
{
    public int fps;
    public TMP_Text fpsTxt;

    float t;
    public void Update ()
    {
        float current = 0;
        current = (int)(1f / Time.unscaledDeltaTime);
        fps = (int)current;
        if(t < 0.2f){
            t += Time.deltaTime;
            return;
        }
        fpsTxt.text = fps.ToString() + " FPS";
        t=0;
    }
}
