Advanced FPS Counter  1.5.0
FPS Counter on steroids!
AFPSCounter Class Reference

Inherits MonoBehaviour.

Static Public Member Functions

static AFPSCounter AddToScene ()
static AFPSCounter AddToScene (bool keepAlive)
static void SelfDestroy ()

Public Attributes

FPSCounterData fpsCounter = new FPSCounterData()
MemoryCounterData memoryCounter = new MemoryCounterData()
DeviceInfoCounterData deviceInfoCounter = new DeviceInfoCounterData()
KeyCode hotKey = KeyCode.BackQuote
bool circleGesture
bool hotKeyCtrl
bool hotKeyShift
bool hotKeyAlt


bool KeepAlive [get]
OperationMode OperationMode [get, set]
bool ForceFrameRate [get, set]
int ForcedFrameRate [get, set]
bool Background [get, set]
Color BackgroundColor [get, set]
int BackgroundPadding [get, set]
bool Shadow [get, set]
Color ShadowColor [get, set]
Vector2 ShadowDistance [get, set]
bool Outline [get, set]
Color OutlineColor [get, set]
Vector2 OutlineDistance [get, set]
bool AutoScale [get, set]
float ScaleFactor [get, set]
Font LabelsFont [get, set]
int FontSize [get, set]
float LineSpacing [get, set]
int CountersSpacing [get, set]
Vector2 PaddingOffset [get, set]
bool PixelPerfect [get, set]
int SortingOrder [get, set]
static AFPSCounter Instance [get]

Detailed Description

Allows to see frames per second counter, memory usage counter and some simple hardware information right in running app on any device.
Just call AFPSCounter.AddToScene() to use it.

You also may add it to GameObject (without any child or parent objects, with zero rotation, zero position and 1,1,1 scale) as usual or through the
"GameObject > Create Other > Code Stage > Advanced FPS Counter" menu.

Member Function Documentation

◆ AddToScene() [1/2]

static AFPSCounter AddToScene ( )

Creates and adds new AFPSCounter instance to the scene if it doesn't exists with keepAlive set to true. Use it to instantiate AFPSCounter from code before using AFPSCounter.Instance.

Existing or new AFPSCounter instance.

◆ AddToScene() [2/2]

static AFPSCounter AddToScene ( bool  keepAlive)

Creates and adds new AFPSCounter instance to the scene if it doesn't exists. Use it to instantiate AFPSCounter from code before using AFPSCounter.Instance.

keepAliveSet true to prevent AFPSCounter's Game Object from destroying on level (scene) load. Applies to the new Instance only.
Existing or new AFPSCounter instance.

◆ SelfDestroy()

static void SelfDestroy ( )

Use it to completely dispose current AFPSCounter instance.

Member Data Documentation

◆ fpsCounter

FPSCounterData fpsCounter = new FPSCounterData()

Frames Per Second counter.

◆ memoryCounter

MemoryCounterData memoryCounter = new MemoryCounterData()

Mono or heap memory counter.

◆ deviceInfoCounter

DeviceInfoCounterData deviceInfoCounter = new DeviceInfoCounterData()

Device hardware info.
Shows CPU name, cores (threads) count, GPU name, total VRAM, total RAM, screen DPI and screen size.

◆ hotKey

KeyCode hotKey = KeyCode.BackQuote

Used to enable / disable plugin at runtime. Set to KeyCode.None to disable.

◆ circleGesture

bool circleGesture

Used to enable / disable plugin at runtime. Make two circle gestures with your finger \ mouse to switch plugin on and off.

◆ hotKeyCtrl

bool hotKeyCtrl

Hot key modifier: any Control on Windows or any Command on Mac.

◆ hotKeyShift

bool hotKeyShift

Hot key modifier: any Shift.

◆ hotKeyAlt

bool hotKeyAlt

Hot key modifier: any Alt.

Property Documentation

◆ KeepAlive

bool KeepAlive

Read-only property allowing to figure out current keepAlive state.

◆ OperationMode

Use it to change AFPSCounter operation mode.

Disabled: removes labels and stops all internal processes except Hot Key listener.
Background: removes labels keeping counters alive. May be useful for hidden performance monitoring and benchmarking. Hot Key has no effect in this mode.
Normal: shows labels and runs all internal processes as usual.

◆ ForceFrameRate

bool ForceFrameRate

Allows to see how your game performs on specified frame rate.
IMPORTANT: this option disables VSync while enabled!

Useful to check how physics performs on slow devices for example.

◆ ForcedFrameRate

int ForcedFrameRate

Desired frame rate for ForceFrameRate option, does not guarantee selected frame rate. Set to -1 to render as fast as possible in current conditions.

◆ Background

bool Background

Background for all texts.

◆ BackgroundColor

Color BackgroundColor

Color of the background.

◆ BackgroundPadding

int BackgroundPadding

Padding of the background. Change forces the HorizontalLayoutGroup.SetLayoutHorizontal() call.

◆ Shadow

bool Shadow

Shadow effect for all texts.

◆ ShadowColor

Color ShadowColor

Color of the shadow effect.

◆ ShadowDistance

Vector2 ShadowDistance

Distance of the shadow effect.

◆ Outline

bool Outline

Outline effect for all texts.

◆ OutlineColor

Color OutlineColor

Color of the outline effect.

◆ OutlineDistance

Vector2 OutlineDistance

Distance of the outline effect.

◆ AutoScale

bool AutoScale

Controls own Canvas Scaler scale mode. Check to use ScaleWithScreenSize. Otherwise ConstantPixelSize will be used.

◆ ScaleFactor

float ScaleFactor

Controls global scale of all texts.

◆ LabelsFont

Font LabelsFont

Font to render labels with.

◆ FontSize

int FontSize

The font size to use (for dynamic fonts).

If this is set to a non-zero value, the font size specified in the font importer is overridden with a custom size. This is only supported for fonts set to use dynamic font rendering. Other fonts will always use the default font size.

◆ LineSpacing

float LineSpacing

Space between lines.

◆ CountersSpacing

int CountersSpacing

Lines count between different counters in a single label.

◆ PaddingOffset

Vector2 PaddingOffset

Pixel offset for anchored labels. Automatically applied to all labels.

◆ PixelPerfect

bool PixelPerfect

Controls own canvas Pixel Perfect property.

◆ SortingOrder

int SortingOrder

Sorting order to use for the canvas.

Set higher value to get closer to the user.

◆ Instance

AFPSCounter Instance

Allows reaching public properties from code. Can be null.

See also