12345678910111213141516171819202122232425 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class FPSView : MonoBehaviour
- {
- private Text _text;
- private void Start()
- {
- _text = GetComponent<Text>();
- StartCoroutine(CUpdate());
- }
- private IEnumerator CUpdate()
- {
- while (true)
- {
- float FPS = 1 / Time.deltaTime;
- _text.text = "FPS: " + FPS.ToString("F0");
- yield return new WaitForSeconds(0.1f);
- }
- }
- }
|