unity3d:显示FPS

2023-08-24 14:30:29 浏览数 (3)

代码语言:javascript复制
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);
    }
}

0 人点赞