void OnGUI() { if (GUILayout.Button("Demo List", GUILayout.MinWidth(120), GUILayout.MinHeight(44))) { showDemoNames = !showDemoNames; } if (showDemoNames) { GUILayout.BeginHorizontal(GUILayout.Width(1000)); GUILayout.BeginVertical("box", w); int counter = 0; for (int j = 0; j < demoNames.Length; j++) { if (GUILayout.Button(demoNames[j], GUILayout.MinWidth(100), GUILayout.MinHeight(44))) { if (demo != null) { demo.ExitPhysics(); } RunDemo(demoNames[j]); } counter++; if (counter > 0 && counter % maxPerCol == 0) { GUILayout.EndVertical(); GUILayout.BeginVertical("box", w); } } GUILayout.EndVertical(); GUILayout.BeginVertical("box", w); if (demo is SoftDemo.SoftDemo) { SoftDemo.SoftDemo sd = (SoftDemo.SoftDemo)demo; SoftDemo.SoftDemo.DemoConstructor[] sdemos = sd.demos; for (int j = 0; j < sdemos.Length; j++) { string nm = sdemos[j].Method.Name; if (GUILayout.Button(nm, GUILayout.MinWidth(100), GUILayout.MinHeight(44))) { sd.demo = j; sd.ClientResetScene(); } counter++; if (counter > 0 && counter % maxPerCol == 0) { GUILayout.EndVertical(); GUILayout.BeginVertical("box", w); } } } GUILayout.EndVertical(); GUILayout.EndHorizontal(); } }