Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- By: Nathan Rumsey
- Engineer 3d llc
- 2022
- */
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using TMPro;
- public class FPS-Counter : MonoBehaviour
- {
- [SerializeField] private TMP_Text _fpsText;
- [SerializeField] private float _hudRefreshRate = 1f;
- private float _timer;
- private void Update()
- {
- if (Time.unscaledTime > _timer)
- {
- int fps = (int)(1f / Time.unscaledDeltaTime);
- _fpsText.text = "FPS: " + fps;
- _timer = Time.unscaledTime + _hudRefreshRate;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement