void OnGUI() { if (started && Time.time > StartTime + TestDuration) { currentTestBlock.Close(); started = false; } GUILayout.BeginArea(new Rect(10, 10, Screen.width, Screen.width)); var richTextLabel = new GUIStyle(); richTextLabel.richText = true; richTextLabel.normal.textColor = Color.cyan; richTextLabel.fontStyle = FontStyle.Bold; GUILayout.Label("Fps: " + (1f / Time.deltaTime).ToString("0.0") + " DeltaTime: " + Time.deltaTime.ToString("0.000") + " Instability: " + (instability * 100f).ToString("0.000") + "% code iterations: " + (currentTestBlock != null ? (CurrentIterationsPerFrame * currentTestBlock.IterationsMultiplier) : CurrentIterationsPerFrame)); sp = GUILayout.BeginScrollView(sp, false, true, GUILayout.Width(Screen.width - 60f), GUILayout.Height(Screen.height - 60f)); GUILayout.BeginHorizontal(GUI.skin.box); InstabilityCorrection = GUILayout.Toggle(InstabilityCorrection, "Instability Corretion"); GUILayout.Label("Looseness: " + Looseness.ToString("0.00")); Looseness = GUILayout.HorizontalSlider(Looseness, 0.1f, 50f); if (GUILayout.Button("Exit")) { UnityEngine.SceneManagement.SceneManager.LoadScene("LevelSelector"); } GUILayout.EndHorizontal(); if (!started && !testingAll && GUILayout.Button("Test All")) { StartCoroutine(TestAll()); } if (testingAll) { GUILayout.Label("<color=lime>" + (((Time.time - TestAllStartTime) / (codes.Count * TestDuration)) * 100f).ToString("0.0") + "%</color>"); if (GUILayout.Button("Stop All")) { started = false; testingAll = false; currentTestBlock.Reset(); StopAllCoroutines(); } } for (int i = 0; i < codes.Count; i++) { GUILayout.BeginHorizontal(GUI.skin.box); GUILayout.BeginVertical(GUI.skin.box); GUILayout.Label(codes[i].name, richTextLabel); if (currentTestBlock != codes[i] || !started) { GUILayout.Label(" Average Framerate: " + codes[i].frameRate.ToString("0.00")); GUILayout.Label(" Average Instability: " + (codes[i].instability * 100f).ToString("0.00") + "%"); GUILayout.Label(" Average Iterations Per Frame: <color=lime>" + Mathf.Abs(codes[i].iterationsCount).ToString("0,000.") + "</color>"); } else { GUILayout.Space(16f); GUILayout.Label(" <color=lime>Running</color>"); GUILayout.Space(16f); } GUILayout.EndVertical(); if (started) { GUI.enabled = false; } if (GUILayout.Button("Go")) { started = true; StartTime = Time.time; currentTestBlock = codes[i]; currentTestBlock.Reset(); CurrentIterationsPerFrame = StartIterationsPerFrame; CurrentCode = codes[i].code; } GUI.enabled = true; GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); GUILayout.EndArea(); }