a Twitter thread from @TheMirzaBeig

a Twitter thread from @TheMirzaBeig

@TwitterVid_bot

1.

#UnityTips: 🧠 Calculate/Render FPS. 🧮🧵

Frame rate is a common performance metric.

In any given frame, FPS

= 1 / deltaTime

For multiple frames, averageFPS

= numFrames / accumulatedDeltaTime

GitHub 🔗: https://github.com/MirzaBeig/FPS-Display

#unity3d #gamedev #indiedev #gamedevelopment

2.

Accumulate using Time.unscaledDeltaTime:

Frame rate measurements should NOT be affected by slow-motion effects or similar artificial time/scale adjustments.

Once the elapsed time is over your update interval, calculate the average FPS, rinse (reset values), and repeat. 🎉

3.

The simplest way to render this:

> GUI.Label(new Rect(16, 16, 200, 100), $"FPS: {fps}")

4.

Here's the full script from the video!

🔗 https://github.com/MirzaBeig/FPS-Display


Read this thread on Twitter


Made by @TwitterVid_bot

Report Page