Skip to main content

FPSCounter

A class in Root.Township, the global namespace.

Measures frame rate as a smoothed average each frame and exposes it statically. Server diagnostics, the frame limiter and physics timing read it.

Constructors​

MemberWhat it is
FPSCounter()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

2 private and internal fields
MemberWhat it is
private float frameModificationWeight of the newest frame in the smoothing (0.1 by default).
private readonly Stopwatch stopwatchTimes each frame.

Properties​

MemberWhat it is
static float FPS { get; private set; }Smoothed frames per second.
static AverageNumber FPSRecord { get; }Running average of FPS values, reset and read by chunk loading profiling.

Methods​

2 private and internal methods
MemberWhat it is
private void Awake()Starts the frame stopwatch.
private void Update()Blends the latest frame's rate into FPS and records it.