Created
July 22, 2011 08:56
-
-
Save AngryAnt/1099119 to your computer and use it in GitHub Desktop.
GUI component flipping through the levels of the game.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void OnGUI () | |
{ | |
bool enabled = GUI.enabled; | |
GUI.enabled = enabled && Application.loadedLevel > 0; | |
if (GUILayout.Button ("Previous")) | |
{ | |
Application.LoadLevel (Application.loadedLevel - 1); | |
} | |
GUI.enabled = enabled && Application.loadedLevel < Application.levelCount; | |
if (GUILayout.Button ("Next")) | |
{ | |
Application.LoadLevel (Application.loadedLevel + 1); | |
} | |
GUI.enabled = enabled; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment