using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FPSShow : MonoBehaviour {
private void OnGUI()
{
string text = string.Format(" FPS:{0}", 1.0f / Time.smoothDeltaTime);
GUIStyle font = new GUIStyle();
font.fontSize = 40;
GUI.Label(new Rect(0, 0, 200, 200), text, font);
}
}
unity3d:显示FPS
最新推荐文章于 2025-07-26 17:56:20 发布
本文介绍了一个使用Unity实现的简单FPS(每秒帧数)显示脚本。该脚本通过计算每帧的时间间隔来实时展示游戏运行时的平均帧率。此方法适用于调试和性能优化。
1426

被折叠的 条评论
为什么被折叠?



