OnGUI를 이용하여 현재 FPS를 출력
float DeltaTime = 0.0f;
void Update()
{
DeltaTime += (Time.deltaTime - DeltaTime) * 0.1f;
}
void OnGUI()
{
float msec = DeltaTime * 1000.0f;
float fps = 1.0f / DeltaTime;
string text = string.Format("{0:0.0}ms, FPS: {1:0.}", msec, fps);
GUI.Label(new Rect(0, 0, 200, 100), text);
}
'Unity > Tip' 카테고리의 다른 글
Unity - 그림자가 안보일 때 (0) | 2020.04.07 |
---|---|
Unity - StackOverflowException: The requested operation caused a stack overflow (0) | 2020.04.02 |
Unity - 문자열 개행, Enter, 줄바꿈 (0) | 2020.03.31 |
Unity - RectTransform의 정확한 좌표 지정하기 (0) | 2020.03.25 |
Unity - Hierarchy에서 안보이는 GameObject 표시하기 (0) | 2020.03.20 |