9 #if UNITY_2017_2_OR_NEWER
16 Debug.Log(
"SteamVR_Stats is deprecated in Unity 2017.2 - REMOVING");
17 DestroyImmediate(
this);
29 public Color fadeColor = Color.black;
30 public float fadeDuration = 1.0f;
36 text = GetComponent<GUIText>();
42 SteamVR_Fade.Start(fadeColor, 0);
43 SteamVR_Fade.Start(Color.clear, fadeDuration);
47 double lastUpdate = 0.0f;
53 if (Input.GetKeyDown(KeyCode.I))
55 text.enabled = !text.enabled;
60 var compositor = OpenVR.Compositor;
61 if (compositor != null)
65 compositor.GetFrameTiming(ref timing, 0);
67 var update = timing.m_flSystemTimeInSeconds;
68 if (update > lastUpdate)
70 var framerate = (lastUpdate > 0.0f) ? 1.0f / (update - lastUpdate) : 0.0f;
72 text.text = string.Format(
"framerate: {0:N0}\ndropped frames: {1}", framerate, (int)timing.m_nNumDroppedFrames);