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);
    }

+ Recent posts