Есть счётчик FPS в игре, но он обновляется слишком быстро. Каким образом можно уменьшить частоту его обновления? (Обновления счётчика, а не кадров на экране)
Синтаксис:
Используется csharp
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class FPS_Counter : MonoBehaviour {
public GameObject FPS_UI;
float fps;
Rect fpsRect;
//GUIStyle style;
// Use this for initialization
void Start () {
//fpsRect = new Rect(100, 100, 400, 100);
//style = new GUIStyle();
//style.fontSize = 30;
}
// Update is called once per frame
void Update () {
}
private void OnGUI()
{
float fps = 1 / Time.deltaTime;
FPS_UI.GetComponent<Text>().text = "" + (int)fps;
}
}
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class FPS_Counter : MonoBehaviour {
public GameObject FPS_UI;
float fps;
Rect fpsRect;
//GUIStyle style;
// Use this for initialization
void Start () {
//fpsRect = new Rect(100, 100, 400, 100);
//style = new GUIStyle();
//style.fontSize = 30;
}
// Update is called once per frame
void Update () {
}
private void OnGUI()
{
float fps = 1 / Time.deltaTime;
FPS_UI.GetComponent<Text>().text = "" + (int)fps;
}
}