public static void GameViewStatsGUI() { GUI.skin = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Scene); GUI.color = new Color(1f, 1f, 1f, 0.75f); float num = 300f; float num2 = 204f; int num3 = Network.connections.Length; if (num3 != 0) { num2 += 220f; } GUILayout.BeginArea(new Rect(GUIView.current.position.width - num - 10f, 27f, num, num2), "Statistics", GUI.skin.window); GUILayout.Label("Audio:", GameViewGUI.sectionHeaderStyle, new GUILayoutOption[0]); StringBuilder stringBuilder = new StringBuilder(400); float audioLevel = UnityStats.audioLevel; stringBuilder.Append(" Level: " + GameViewGUI.FormatDb(audioLevel) + ((!EditorUtility.audioMasterMute) ? "\n" : " (MUTED)\n")); stringBuilder.Append(string.Format(" Clipping: {0:F1}%", 100f * UnityStats.audioClippingAmount)); GUILayout.Label(stringBuilder.ToString(), new GUILayoutOption[0]); GUI.Label(new Rect(170f, 40f, 120f, 20f), string.Format("DSP load: {0:F1}%", 100f * UnityStats.audioDSPLoad)); GUI.Label(new Rect(170f, 53f, 120f, 20f), string.Format("Stream load: {0:F1}%", 100f * UnityStats.audioStreamLoad)); GUILayout.Label("Graphics:", GameViewGUI.sectionHeaderStyle, new GUILayoutOption[0]); GameViewGUI.UpdateFrameTime(); string text = string.Format("{0:F1} FPS ({1:F1}ms)", 1f / Mathf.Max(GameViewGUI.m_MaxFrameTime, 1E-05f), GameViewGUI.m_MaxFrameTime * 1000f); GUI.Label(new Rect(170f, 75f, 120f, 20f), text); int screenBytes = UnityStats.screenBytes; int num4 = UnityStats.dynamicBatchedDrawCalls - UnityStats.dynamicBatches; int num5 = UnityStats.staticBatchedDrawCalls - UnityStats.staticBatches; int num6 = UnityStats.instancedBatchedDrawCalls - UnityStats.instancedBatches; StringBuilder stringBuilder2 = new StringBuilder(400); if (GameViewGUI.m_ClientFrameTime > GameViewGUI.m_RenderFrameTime) { stringBuilder2.Append(string.Format(" CPU: main <b>{0:F1}</b>ms render thread {1:F1}ms\n", GameViewGUI.m_ClientFrameTime * 1000f, GameViewGUI.m_RenderFrameTime * 1000f)); } else { stringBuilder2.Append(string.Format(" CPU: main {0:F1}ms render thread <b>{1:F1}</b>ms\n", GameViewGUI.m_ClientFrameTime * 1000f, GameViewGUI.m_RenderFrameTime * 1000f)); } stringBuilder2.Append(string.Format(" Batches: <b>{0}</b> \tSaved by batching: {1}\n", UnityStats.batches, num4 + num5 + num6)); stringBuilder2.Append(string.Format(" Tris: {0} \tVerts: {1} \n", GameViewGUI.FormatNumber(UnityStats.triangles), GameViewGUI.FormatNumber(UnityStats.vertices))); stringBuilder2.Append(string.Format(" Screen: {0} - {1}\n", UnityStats.screenRes, EditorUtility.FormatBytes(screenBytes))); stringBuilder2.Append(string.Format(" SetPass calls: {0} \tShadow casters: {1} \n", UnityStats.setPassCalls, UnityStats.shadowCasters)); stringBuilder2.Append(string.Format(" Visible skinned meshes: {0} Animations: {1}", UnityStats.visibleSkinnedMeshes, UnityStats.visibleAnimations)); GUILayout.Label(stringBuilder2.ToString(), GameViewGUI.labelStyle, new GUILayoutOption[0]); if (num3 != 0) { GUILayout.Label("Network:", GameViewGUI.sectionHeaderStyle, new GUILayoutOption[0]); GUILayout.BeginHorizontal(new GUILayoutOption[0]); for (int i = 0; i < num3; i++) { GUILayout.Label(UnityStats.GetNetworkStats(i), new GUILayoutOption[0]); } GUILayout.EndHorizontal(); } else { GUILayout.Label("Network: (no players connected)", GameViewGUI.sectionHeaderStyle, new GUILayoutOption[0]); } GUILayout.EndArea(); }
public static void GameViewStatsGUI() { GUI.skin = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Scene); GUI.color = new Color(1f, 1f, 1f, 0.75f); float width = 300f; float height = 204f; int length = Network.connections.Length; if (length != 0) { height += 220f; } GUILayout.BeginArea(new Rect((GUIView.current.position.width - width) - 10f, 27f, width, height), "Statistics", GUI.skin.window); GUILayout.Label("Audio:", sectionHeaderStyle, new GUILayoutOption[0]); StringBuilder builder = new StringBuilder(400); float audioLevel = UnityStats.audioLevel; builder.Append(" Level: " + FormatDb(audioLevel) + (!EditorUtility.audioMasterMute ? "\n" : " (MUTED)\n")); builder.Append($" Clipping: {100f * UnityStats.audioClippingAmount:F1}%"); GUILayout.Label(builder.ToString(), new GUILayoutOption[0]); GUI.Label(new Rect(170f, 40f, 120f, 20f), $"DSP load: {100f * UnityStats.audioDSPLoad:F1}%"); GUI.Label(new Rect(170f, 53f, 120f, 20f), $"Stream load: {100f * UnityStats.audioStreamLoad:F1}%"); GUILayout.Label("Graphics:", sectionHeaderStyle, new GUILayoutOption[0]); UpdateFrameTime(); string text = $"{1f / Mathf.Max(m_MaxFrameTime, 1E-05f):F1} FPS ({m_MaxFrameTime * 1000f:F1}ms)"; GUI.Label(new Rect(170f, 75f, 120f, 20f), text); int screenBytes = UnityStats.screenBytes; int num6 = UnityStats.dynamicBatchedDrawCalls - UnityStats.dynamicBatches; int num7 = UnityStats.staticBatchedDrawCalls - UnityStats.staticBatches; int num8 = UnityStats.instancedBatchedDrawCalls - UnityStats.instancedBatches; StringBuilder builder2 = new StringBuilder(400); if (m_ClientFrameTime > m_RenderFrameTime) { builder2.Append($" CPU: main <b>{m_ClientFrameTime * 1000f:F1}</b>ms render thread {m_RenderFrameTime * 1000f:F1}ms "); } else { builder2.Append($" CPU: main {m_ClientFrameTime * 1000f:F1}ms render thread <b>{m_RenderFrameTime * 1000f:F1}</b>ms "); } builder2.Append($" Batches: <b>{UnityStats.batches}</b> Saved by batching: {(num6 + num7) + num8} "); builder2.Append($" Tris: {FormatNumber(UnityStats.triangles)} Verts: {FormatNumber(UnityStats.vertices)} "); builder2.Append($" Screen: {UnityStats.screenRes} - {EditorUtility.FormatBytes(screenBytes)} "); builder2.Append($" SetPass calls: {UnityStats.setPassCalls} Shadow casters: {UnityStats.shadowCasters} "); builder2.Append($" Visible skinned meshes: {UnityStats.visibleSkinnedMeshes} Animations: {UnityStats.visibleAnimations}"); GUILayout.Label(builder2.ToString(), labelStyle, new GUILayoutOption[0]); if (length != 0) { GUILayout.Label("Network:", sectionHeaderStyle, new GUILayoutOption[0]); GUILayout.BeginHorizontal(new GUILayoutOption[0]); for (int i = 0; i < length; i++) { GUILayout.Label(UnityStats.GetNetworkStats(i), new GUILayoutOption[0]); } GUILayout.EndHorizontal(); } else { GUILayout.Label("Network: (no players connected)", sectionHeaderStyle, new GUILayoutOption[0]); } GUILayout.EndArea(); }