Search code snippets, questions, articles...

Framerate in Unity

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
 
 public class frameRate : MonoBehaviour {
     public Text fpsText;
     public float deltaTime;
 
     void Update () {
         deltaTime += (Time.deltaTime - deltaTime) * 0.1f;
         float fps = 1.0f / deltaTime;
         fpsText.text = Mathf.Ceil (fps).ToString ();
     }
 }

Search Index Data (The code snippet can also be found with below search text)

Frame Rate
Unity
3D
FPS
Framerate
Was this helpful?
0 Comments
Programming Feeds
Learn something new everyday on Devsheet