HKI Core
FPSInfo.cs
Go to the documentation of this file.
1 using UnityEngine;
2 using UnityEngine.UI;
3 
4 namespace HKI.Core.Debuging
5 {
9  public class FPSInfo : MonoBehaviour
10  {
11  // Public variables
12  [SerializeField] Text CurrentFPSText = null;
13  [SerializeField] Text AvgFPSText = null;
14  [SerializeField] Text MinFPSText = null;
15  [SerializeField] Text MaxFPSText = null;
16 
17  [SerializeField] RawImage GraphImage = null;
18 
19  // Interface functions
20  public void Init(FPSCalc fpsCalc)
21  {
22  GraphImage.texture = fpsCalc.GraphTexture;
23  }
24 
25  public void UpdateInfo(FPSCalc fpsCalc)
26  {
27  if(CurrentFPSText != null)
28  CurrentFPSText.text = fpsCalc.CurrentFPSAndFrameTimeString;
29 
30  if(AvgFPSText != null)
31  AvgFPSText.text = fpsCalc.AvgFPSAndFrameTimeString;
32 
33  if(MinFPSText != null && fpsCalc.MinFPSChanged)
34  MinFPSText.text = fpsCalc.MinFPSAndFrameTimeString;
35 
36  if(MaxFPSText != null && fpsCalc.MaxFPSChanged)
37  MaxFPSText.text = fpsCalc.MaxFPSAndFrameTimeString;
38  }
39  }
40 }
void Init(FPSCalc fpsCalc)
Definition: FPSInfo.cs:20
Texture2D GraphTexture
Definition: FPSCalc.cs:80
This class calcs the fps and greates the graph.
Definition: FPSCalc.cs:11
string MinFPSAndFrameTimeString
Definition: FPSCalc.cs:87
This MonoBehaviour updates the UI of the DebugSystem/Console with the FPS information calced by FPSCa...
Definition: FPSInfo.cs:9
void UpdateInfo(FPSCalc fpsCalc)
Definition: FPSInfo.cs:25
string CurrentFPSAndFrameTimeString
Definition: FPSCalc.cs:82
string AvgFPSAndFrameTimeString
Definition: FPSCalc.cs:84
string MaxFPSAndFrameTimeString
Definition: FPSCalc.cs:90