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((float)((double)GUIView.current.position.width - (double)width - 10.0), 27f, width, height), "Statistics", GUI.skin.window); GUILayout.Label("Audio:", GameViewGUI.sectionHeaderStyle, new GUILayoutOption[0]); StringBuilder stringBuilder1 = new StringBuilder(400); float audioLevel = UnityStats.audioLevel; stringBuilder1.Append(" Level: " + GameViewGUI.FormatDb(audioLevel) + (!EditorUtility.audioMasterMute ? "\n" : " (MUTED)\n")); stringBuilder1.Append(string.Format(" Clipping: {0:F1}%", (object)(float)(100.0 * (double)UnityStats.audioClippingAmount))); GUILayout.Label(stringBuilder1.ToString()); GUI.Label(new Rect(170f, 40f, 120f, 20f), string.Format("DSP load: {0:F1}%", (object)(float)(100.0 * (double)UnityStats.audioDSPLoad))); GUI.Label(new Rect(170f, 53f, 120f, 20f), string.Format("Stream load: {0:F1}%", (object)(float)(100.0 * (double)UnityStats.audioStreamLoad))); GUILayout.Label("Graphics:", GameViewGUI.sectionHeaderStyle, new GUILayoutOption[0]); GameViewGUI.UpdateFrameTime(); GUI.Label(new Rect(170f, 75f, 120f, 20f), string.Format("{0:F1} FPS ({1:F1}ms)", (object)(float)(1.0 / (double)Mathf.Max(GameViewGUI.m_MaxFrameTime, 1E-05f)), (object)(float)((double)GameViewGUI.m_MaxFrameTime * 1000.0))); int screenBytes = UnityStats.screenBytes; int num1 = UnityStats.dynamicBatchedDrawCalls - UnityStats.dynamicBatches; int num2 = UnityStats.staticBatchedDrawCalls - UnityStats.staticBatches; StringBuilder stringBuilder2 = new StringBuilder(400); if ((double)GameViewGUI.m_ClientFrameTime > (double)GameViewGUI.m_RenderFrameTime) { stringBuilder2.Append(string.Format(" CPU: main <b>{0:F1}</b>ms render thread {1:F1}ms\n", (object)(float)((double)GameViewGUI.m_ClientFrameTime * 1000.0), (object)(float)((double)GameViewGUI.m_RenderFrameTime * 1000.0))); } else { stringBuilder2.Append(string.Format(" CPU: main {0:F1}ms render thread <b>{1:F1}</b>ms\n", (object)(float)((double)GameViewGUI.m_ClientFrameTime * 1000.0), (object)(float)((double)GameViewGUI.m_RenderFrameTime * 1000.0))); } stringBuilder2.Append(string.Format(" Batches: <b>{0}</b> \tSaved by batching: {1}\n", (object)UnityStats.batches, (object)(num1 + num2))); stringBuilder2.Append(string.Format(" Tris: {0} \tVerts: {1} \n", (object)GameViewGUI.FormatNumber(UnityStats.triangles), (object)GameViewGUI.FormatNumber(UnityStats.vertices))); stringBuilder2.Append(string.Format(" Screen: {0} - {1}\n", (object)UnityStats.screenRes, (object)EditorUtility.FormatBytes(screenBytes))); stringBuilder2.Append(string.Format(" SetPass calls: {0} \tShadow casters: {1} \n", (object)UnityStats.setPassCalls, (object)UnityStats.shadowCasters)); stringBuilder2.Append(string.Format(" Visible skinned meshes: {0} Animations: {1}", (object)UnityStats.visibleSkinnedMeshes, (object)UnityStats.visibleAnimations)); GUILayout.Label(stringBuilder2.ToString(), GameViewGUI.labelStyle, new GUILayoutOption[0]); if (length != 0) { GUILayout.Label("Network:", GameViewGUI.sectionHeaderStyle, new GUILayoutOption[0]); GUILayout.BeginHorizontal(); for (int i = 0; i < length; ++i) { GUILayout.Label(UnityStats.GetNetworkStats(i)); } 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 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.trianglesLong), GameViewGUI.FormatNumber(UnityStats.verticesLong))); 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(1, 1, 1, .75f); float w = 300, h = 204; // Increase windows size to make room for network data int connectionCount = Network.connections.Length; if (connectionCount != 0) { h += 220; } GUILayout.BeginArea(new Rect(GUIView.current.position.width - w - 10, 27, w, h), "Statistics", GUI.skin.window); // Audio stats GUILayout.Label("Audio:", sectionHeaderStyle); StringBuilder audioStats = new StringBuilder(400); float audioLevel = UnityStats.audioLevel; audioStats.Append(" Level: " + FormatDb(audioLevel) + (EditorUtility.audioMasterMute ? " (MUTED)\n" : "\n")); audioStats.Append(String.Format(" Clipping: {0:F1}%", 100.0f * UnityStats.audioClippingAmount)); GUILayout.Label(audioStats.ToString()); GUI.Label(new Rect(170, 40, 120, 20), String.Format("DSP load: {0:F1}%", 100.0f * UnityStats.audioDSPLoad)); GUI.Label(new Rect(170, 53, 120, 20), String.Format("Stream load: {0:F1}%", 100.0f * UnityStats.audioStreamLoad)); // Graphics stats GUILayout.Label("Graphics:", sectionHeaderStyle); // Time stats UpdateFrameTime(); string timeStats = System.String.Format("{0:F1} FPS ({1:F1}ms)", 1.0f / Mathf.Max(m_MaxFrameTime, 1.0e-5f), m_MaxFrameTime * 1000.0f); GUI.Label(new Rect(170, 75, 120, 20), timeStats); int screenBytes = UnityStats.screenBytes; int batchesSavedByDynamicBatching = UnityStats.dynamicBatchedDrawCalls - UnityStats.dynamicBatches; int batchesSavedByStaticBatching = UnityStats.staticBatchedDrawCalls - UnityStats.staticBatches; int batchesSavedByInstancing = UnityStats.instancedBatchedDrawCalls - UnityStats.instancedBatches; StringBuilder gfxStats = new StringBuilder(400); if (m_ClientFrameTime > m_RenderFrameTime) { gfxStats.Append(String.Format(" CPU: main <b>{0:F1}</b>ms render thread {1:F1}ms\n", m_ClientFrameTime * 1000.0f, m_RenderFrameTime * 1000.0f)); } else { gfxStats.Append(String.Format(" CPU: main {0:F1}ms render thread <b>{1:F1}</b>ms\n", m_ClientFrameTime * 1000.0f, m_RenderFrameTime * 1000.0f)); } gfxStats.Append(String.Format(" Batches: <b>{0}</b> \tSaved by batching: {1}\n", UnityStats.batches, batchesSavedByDynamicBatching + batchesSavedByStaticBatching + batchesSavedByInstancing)); gfxStats.Append(String.Format(" Tris: {0} \tVerts: {1} \n", FormatNumber(UnityStats.trianglesLong), FormatNumber(UnityStats.verticesLong))); gfxStats.Append(String.Format(" Screen: {0} - {1}\n", UnityStats.screenRes, EditorUtility.FormatBytes(screenBytes))); gfxStats.Append(String.Format(" SetPass calls: {0} \tShadow casters: {1} \n", UnityStats.setPassCalls, UnityStats.shadowCasters)); gfxStats.Append(String.Format(" Visible skinned meshes: {0} Animations: {1}", UnityStats.visibleSkinnedMeshes, UnityStats.visibleAnimations)); GUILayout.Label(gfxStats.ToString(), labelStyle); // Networking stats if (connectionCount != 0) { GUILayout.Label("Network:", sectionHeaderStyle); GUILayout.BeginHorizontal(); for (int i = 0; i < connectionCount; i++) { GUILayout.Label(UnityStats.GetNetworkStats(i)); } GUILayout.EndHorizontal(); } else { GUILayout.Label("Network: (no players connected)", sectionHeaderStyle); } 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(); }