ReplayPuzzleGame/Assets/Scripts/Utility/UpdateFpsUI.cs
qoralstmd6825 56667ad065 타이틀과 레벨 선택창 제작
새로운 레벨을 추가할때 씬 이름을 Level_레벨숫자 로 적고 build Setting 에서 scene 추가하기
2026-02-04 14:31:41 +09:00

33 lines
664 B
C#

using UnityEngine;
using UnityEngine.UI;
public class UpdateFpsUI : MonoBehaviour
{
private Text fpsText;
private float frameCount = 0;
private float deltaTime = 0f;
private float fps = 0f;
void Start()
{
Application.targetFrameRate = 120;
fpsText = transform.GetComponent<Text>();
}
void Update()
{
Debug.Log("Test");
frameCount++;
deltaTime += Time.unscaledDeltaTime;
if (deltaTime > 1)
{
fps = frameCount / deltaTime;
fpsText.text = $"fps : {Mathf.Round(fps)}";
frameCount = 0;
deltaTime = 0f;
}
}
}