void OnGUI() { // If the splash screen is showing, if (showSplash) { // draw the splash screen. titleScreen_Splash.OnGUI(); } // Otherwise, else { // draw the menu. titleScreen_Menu.OnGUI(); // Here you would check to see which button was pressed, and react. if (buttonNew.pressed) { Debug.Log("Starting a new game..."); } else if (buttonLoad.pressed) { Debug.Log("Accessing Load Game Screen..."); } else if (buttonQuit.pressed) { Application.Quit(); } } }
void OnGUI() { // If there is no GUIAsset, exit the method. if (!gui) { return; } // Finally, call the GUIAsset's OnGUI method // to display and handle the GUI Components. gui.OnGUI(); // Down here is where you would check the components // for changes or values, and react to them. //foreach (GUIComponent component in gui) // GUILayout.Label(component.name); // You can access GUIComponents in a GUIAsset in three ways. // 1. Use a Foreach Loop, as shown above. // 2. Use the GUIAsset like an array: gui[index] // 3. Use the Find or Find<T> method to search for a GUIComponent with a specific name. }