ZoeAppClass/Assets/Scenes/FPS.cs

33 lines
621 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class FPS : MonoBehaviour
{
int fps; float seconds; Text txtFps;
// Start is called before the first frame update
void Start()
{
txtFps = GetComponent<Text>();
StartCoroutine(fpsTest());
}
IEnumerator fpsTest() {
while (true)
{
yield return new WaitForSecondsRealtime(1);
txtFps.text = fps.ToString();
fps = 0;
}
}
// Update is called once per frame
void Update()
{
fps++;
}
}