Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class FPSmeter : MonoBehaviour2 {
- public Text text;
- public float updateTime = 0.5f;
- private int frameCounter = 0;
- // Use this for initialization
- void Start () {
- InvokeDelegate(UpdateMeter, updateTime);
- }
- // Update is called once per frame
- void Update () {
- frameCounter++;
- }
- void UpdateMeter()
- {
- string s = ((float)frameCounter / updateTime).ToString("F1");
- frameCounter = 0;
- text.text = s;
- InvokeDelegate(UpdateMeter, updateTime);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement