void ProfilerVisualizer.OnGUI() { if (!layout.visible) { return; } GUI.color = new Color(1, 1, 1, .75f); Vector2 size = GUI.skin.label.CalcSize(profilerLabel) + GUI.skin.label.CalcSize(memoryLabel) + GUI.skin.label.CalcSize(dataLayout); size.y += 10; //Extra padding to avoid the scrollbars from showing up too often Rect rect = layout.layout; rect.height = size.y > rect.height ? rect.height : size.y; Rect pos = layout.getPosition(rect); GUILayout.BeginArea(pos, profilerLabel, GUI.skin.window); scrollPos = GUILayout.BeginScrollView(scrollPos); GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); GUILayout.Label(fpsLayout); GUILayout.Label(dataLayout); GUILayout.EndVertical(); GUILayout.BeginVertical(); GUILayout.Label(memoryLabel); GUILayout.Label(labelLayout); GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.EndScrollView(); GUILayout.EndArea(); }
void ProfilerVisualizer.OnGUI() { if (layout.visible) { if (drawTimer > 1) { cache = new GUIContent(String.Format("<color=#00ff00ff><b>{0:F2}</b></color>", currentFPS)); drawTimer = 0; } GUI.Label(layout.getPosition(), cache); } drawTimer += Time.deltaTime; }
void ProfilerVisualizer.OnGUI() { if (!layout.visible || layout.transparancy < 0.05f) { return; } Rect area = layout.getPosition(); if (layout.visible) { Vector2 position = area.position; position.x = (2 * position.x) / Screen.width - 1; position.y = ((2 * (Screen.height - position.y - area.height)) / Screen.height - 1); float scaleX = 2 * ((area.width / samplingSize) / Screen.width); float scaleY = 2 * ((area.height / maxFrameTime) / Screen.height); mat.SetMatrix("_MVP", Matrix4x4.TRS(position, Quaternion.identity, new Vector3(scaleX, scaleY))); mat.SetFloat("_Transparancy", layout.transparancy); for (int i = 0; i < mesh.subMeshCount; i++) { if (shouldRender[i]) { mat.color = colors[i]; mat.SetPass(0); Graphics.DrawMeshNow(mesh, Vector2.zero, Quaternion.identity, i); } } } legend.style = GUI.skin.textArea; legend.style.richText = true; for (int i = 0; i < legend.labels.Length; i++) { Vector2 pos = new Vector2(area.x + 2, area.y + area.height - (legend.positions[i] / maxFrameTime) * area.height - legend.labelSizes[i].y); if (pos.x >= area.x && (pos.y + legend.labelSizes[i].y) >= area.y) { GUI.Box(new Rect(pos, legend.labelSizes[i]), legend.labels[i], legend.style); } } }