FPSScript.cs 536 B

12345678910111213141516171819202122
  1. using System;
  2. using System.Collections;
  3. using TMPro;
  4. using UnityEngine;
  5. namespace GPUECSAnimationBaker.Samples.SampleScenes
  6. {
  7. public class FPSScript : MonoBehaviour
  8. {
  9. private IEnumerator Start()
  10. {
  11. TextMeshProUGUI text = GetComponent<TextMeshProUGUI>();
  12. GUI.depth = 2;
  13. while (true)
  14. {
  15. text.text = Math.Round(1f / Time.unscaledDeltaTime).ToString() + " FPS";
  16. yield return new WaitForSeconds(0.1f);
  17. }
  18. }
  19. }
  20. }