首次提交

This commit is contained in:
Bob.Song
2026-03-05 18:07:55 +08:00
commit e125bb869e
4534 changed files with 563920 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
using System;
using TMPro;
using UnityEngine;
namespace NBF
{
public class FPSShower : MonoBehaviour
{
public TextMeshProUGUI TextFPS;
public float updateInterval = 0.2f; // 更新间隔(秒)
private float accum = 0;
private int frames = 0;
private float timeleft;
private void Awake()
{
Application.targetFrameRate = 300; // 设为极高值
}
public int FPS;
void Update()
{
timeleft -= Time.deltaTime;
accum += Time.timeScale / Time.deltaTime;
frames++;
if (timeleft <= 0.0f)
{
FPS = (int)(accum / frames);
timeleft = updateInterval;
accum = 0.0f;
frames = 0;
TextFPS.text = FPS.ToString();
}
}
}
}