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

public class FPSCounter : MonoBehaviour
{
    [SerializeField] private TMP_Text counterText;
    
    private int count;
    private float time;
    
    void Start()
    {
        time = Time.time + 1f;
    }

    // Update is called once per frame
    void Update()
    {
        count++;
        if (time < Time.time)
        {
            counterText.text = "FPS: " + count.ToString();
            time = Time.time + 1f;
            count = 0;
        }
    }
}
