Friday, January 4, 2019

How to show FPS in Unity3D C#

Showing FPS can be helpful when you’re on a handheld device and gauging performance.

Sometimes you may need to throttle quality for device depending on the performance.

This code is how you display FPS in C# for a mono behaviour script.


  1. void Update () {
  2. deltaTime += (Time.deltaTime - deltaTime) * 0.1f;
  3. float fps = 1.0f / deltaTime;
  4. Debug.Log(Mathf.Ceil(fps).ToString() + “ FPS”);
  5. }

No comments:

Post a Comment

Generating "Always On Top" NSWindow in macOS across all detected displays

Also: Using UIKit & Cocoa Frameworks using Objective-C In m acOS or OS X , written in either Objective-C or Swift  Langues, you m...