Feel  3.16
The best way to improve your game's feel and make it extra juicy
MoreMountains.Tools.MMFPSCounter Class Reference

Add this class to a gameObject with a Text component and it'll feed it the number of FPS in real time. More...

Inheritance diagram for MoreMountains.Tools.MMFPSCounter:

Public Types

enum  Modes { Modes.Instant, Modes.MovingAverage, Modes.InstantAndMovingAverage }
 

Public Attributes

float UpdateInterval = 0.3f
 the frequency at which the FPS counter should update (in seconds) More...
 
Modes Mode = Modes.Instant
 if this is true, this counter will display a moving average of the framerate, not its instant framerate More...
 

Protected Member Functions

virtual void Start ()
 On Start(), we get the Text component and initialize our counter More...
 
virtual void Update ()
 On Update, we increment our various counters, and if we've reached our UpdateInterval, we update our FPS counter with the number of frames displayed since the last counter update More...
 

Protected Attributes

float _framesAccumulated = 0f
 
float _framesDrawnInTheInterval = 0f
 
float _timeLeft
 
Text _text
 
int _currentFPS
 
int _totalFrames = 0
 
int _average
 

Detailed Description

Add this class to a gameObject with a Text component and it'll feed it the number of FPS in real time.

Member Enumeration Documentation

◆ Modes

Enumerator
Instant 
MovingAverage 
InstantAndMovingAverage 

Member Function Documentation

◆ Start()

virtual void MoreMountains.Tools.MMFPSCounter.Start ( )
protectedvirtual

On Start(), we get the Text component and initialize our counter

◆ Update()

virtual void MoreMountains.Tools.MMFPSCounter.Update ( )
protectedvirtual

On Update, we increment our various counters, and if we've reached our UpdateInterval, we update our FPS counter with the number of frames displayed since the last counter update

Member Data Documentation

◆ _average

int MoreMountains.Tools.MMFPSCounter._average
protected

◆ _currentFPS

int MoreMountains.Tools.MMFPSCounter._currentFPS
protected

◆ _framesAccumulated

float MoreMountains.Tools.MMFPSCounter._framesAccumulated = 0f
protected

◆ _framesDrawnInTheInterval

float MoreMountains.Tools.MMFPSCounter._framesDrawnInTheInterval = 0f
protected

◆ _text

Text MoreMountains.Tools.MMFPSCounter._text
protected

◆ _timeLeft

float MoreMountains.Tools.MMFPSCounter._timeLeft
protected

◆ _totalFrames

int MoreMountains.Tools.MMFPSCounter._totalFrames = 0
protected

◆ Mode

Modes MoreMountains.Tools.MMFPSCounter.Mode = Modes.Instant

if this is true, this counter will display a moving average of the framerate, not its instant framerate

◆ UpdateInterval

float MoreMountains.Tools.MMFPSCounter.UpdateInterval = 0.3f

the frequency at which the FPS counter should update (in seconds)


The documentation for this class was generated from the following file: