Hi, I've been trying to create a simple menu with 2 entries. Both of the entries are supposed to open the same scene, the only different thing is that a boolean is set depending on which entry is pressed. Here is a screenshot of the menu: Here is the script for it: This is some additional code that just makes is clearer why I need if ( MenuScript.automate == true) runAutomatically (); else if (MenuScript.automate == false) runOnKeyInput (); I need to mention that I have added the MenuScript to my empty MenuController game object and I have added box colliders for the 2 entries in the menu. Thanks, Karina
Are you sure that the Raycast is hitting the buttons? Try adding Debug.Log() statements. Or consider using OnGUI() instead of GUIText. You could replace Update() with: Code (csharp): void OnGUI() { GUILayout.Label("Run Animation"); if (GUILayout.Button("Automatically")) { GotoNextLevel(true); } if (GUILayout.Button("On Key Press")) { GotoNextLevel(false); } } private void GotoNextLevel(bool autoValue) { automate = autoValue; Application.LoadLevel("Robot"); } If you don't like the appearance of the GUI labels and buttons, you can create a custom GUI skin and assign it to GUI.skin at the beginning of OnGUI: Code (csharp): public GUISkin customSkin; // <-- Assign this in the inspector. void OnGUI() { GUI.skin = customSkin; GUILayout.Label("Run Animation"); if (GUILayout.Button("Automatically")) { GotoNextLevel(true); } if (GUILayout.Button("On Key Press")) { GotoNextLevel(false); } } ...