using UnityEngine;
using UnityEngine.UI;
using System.Collections;
namespace FBCapture
{
    public class FPSScript : MonoBehaviour
    {
        /// 
        /// Delta time
        /// 
        float deltaTime = 0.0f;
        /// 
        /// It will be used for printing out fps text on screen
        /// 
        Text text;
        void Start()
        {
            text = GetComponent();
        }
        void Update()
        {
            deltaTime += (Time.deltaTime - deltaTime) * 0.1f;
            float msec = deltaTime * 1000.0f;
            float fps = 1.0f / deltaTime;
            text.text = string.Format("{0:0.0} ms ({1:0.} fps)", msec, fps);
        }
    }
}