Interhaptics SDK for Unity 1.6
Loading...
Searching...
No Matches
DisplayFPS.cs
Go to the documentation of this file.
1using UnityEngine;
2using UnityEngine.UI;
3
5{
6 public class DisplayFPS : MonoBehaviour
7 {
8 public Text fpsText; // Change TextMesh to TMP_Text
9 private float deltaTime;
10
11 void Update()
12 {
13 deltaTime += (Time.deltaTime - deltaTime) * 0.1f;
14 float msec = deltaTime * 1000.0f;
15 float fps = 1.0f / deltaTime;
16 fpsText.text = string.Format("{0:0.0} ms ({1:0.} fps)", msec, fps); // This line remains the same
17 }
18 }
19}