Class FrameProbe
- Namespace
- GrindFest
- Assembly
- GrindFest.dll
Logs one measurement line every couple of seconds while a development build runs: frame time, garbage collection, and what FMOD is costing.
public class FrameProbe : MonoBehaviour
- Inheritance
-
objectFrameProbe
Remarks
Why this exists rather than an overlay: both overlays that already exist are visual. Unity's Web
diagnostics overlay shows FPS, frame stalls and memory, and FMOD's own overlay (RuntimeManager.DrawDebugOverlay,
enabled per platform with the FMOD settings' Overlay property) shows FMOD's CPU, memory and real/total channel
counts - but neither can be read back out of a browser afterwards. A Debug.Log line can, and that is how
every measurement in this project has actually been taken: run the page, grep the Playwright console log,
aggregate. The write-up of that habit is in the WebGL notes; this is the line it needed.
What it reports, and why each one:
- frames, average and worst frame time over the window: the frame budget as the player experiences it;
- frames over 100 ms: the count that matters, because this is the "it stops for a second" symptom;
- GC collection counts and managed heap growth: on WebAssembly the collector runs once per frame rather than incrementally, so allocation churn turns straight into frame time - which is the thing to check before blaming anything else;
- FMOD's channels (real vs total, the numbers RealChannelCount/VirtualChannelCount cap) and its DSP load, read through reflection because RuntimeManager keeps both systems private.
Everything is inside try/catch: a probe that throws would be worse than no probe, and the FMOD half reads private fields, so it is allowed to fail quietly and just say so.
Development builds only. The whole file compiles away in a release build.