2015/08/04//////////////
by xbw/////////////////////
Environment Unity 4.6//////////
Check it out first.
That's good,,,
to code
Using unityengine;using System.Collections; [Requirecomponent (typeof (Audiosource))]public class Mainmenugui:monobehaviour {public AudioClip beep; Public Guiskin Menuskin; Public Rect menuarea; Public Rect PlayButton; Public Rect Instructionsbutton; Public Rect Quitbutton; Public Rect Playwaysbutton; public Rect instructions; Public Rect Highscoresbutton; Public texture2d img; Rect menuareanormalized; String menupage = "main";//use of this for Initializationvoid Start () {menuareanormalized = new Rect uarea.x * Screen.width-(Menuarea.width * 0.3f), MENUAREA.Y * screen.height-(Menuarea.height * 0.3f), Menuarea.width, M Enuarea.height); menuareanormalized =//New Rect (Screen.width, screen.height);} void Ongui () {Guistyle backGround = new Guistyle (); BackGround.normal.background = img; Gui. Label (New Rect (0, 0, Screen.width, screen.height), "", BackGround); Gui.skin = mEnuskin; Gui. BeginGroup (menuareanormalized); if (Menupage = = "Main") {if (GUI. button (new Rect (PlayButton), "test Mode")) {//startcoroutine ("buttonaction", "second"); Application.loadlevel ("second"); Audio. Playoneshot (beep); Menupage = "Test"; } if (GUI. button (new Rect (Highscoresbutton), "Cool run Mode")) {//audio. Playoneshot (beep); Startcoroutine ("Buttonaction", "Loading4"); } if (GUI. button (new Rect (Instructionsbutton), "Introduction Note")) {audio. Playoneshot (beep); Menupage = "Instructions"; }//if (GUI. button (new Rect (Playwaysbutton), "Playways"))//{//audio. Playoneshot (beep); Menupage = "Playways"; } if (GUI. button (new Rect (Quitbutton), "Exit Game")) {Startcoroutine ("Buttonaction "," Quit "); }} else if (menupage== "instructions") {GUI. Label (new Rect (instructions), "Linglong Tire test mode (truck, sports car, parking entry test, direction key control), Linglong Parkour mode (collect four exquisite tires, space/touch, move around by collision)"); if (GUI. button (new Rect (Quitbutton), "back")) {audio. Playoneshot (beep); Menupage = "main"; }} else if (Menupage = = "Instructionsa") {GUI. Label (new Rect (instructions), "Unlocked, select cool run mode"); if (GUI. button (new Rect (Quitbutton), "back")) {audio. Playoneshot (beep); Menupage = "main"; }} else if (Menupage = = "Instructionsb") {GUI. Label (new Rect (instructions), "Unlocked, select cool run mode"); if (GUI. button (new Rect (Quitbutton), "back")) {audio. Playoneshot (beep); Menupage = "main"; }} else if (Menupage = = "INSTRUCTIONSC") { Gui. Label (new Rect (instructions), "Unlocked, select cool run mode"); if (GUI. button (new Rect (Quitbutton), "back")) {audio. Playoneshot (beep); Menupage = "main"; }} else if (menupage== "test") {//gui. Label (new Rect (instructions), "Direction key control movement"); if (GUI. button (new Rect (PlayButton), "Truck")) {audio. Playoneshot (beep); Menupage = "main"; Startcoroutine ("Buttonaction", "Loading"); Menupage = "Instructionsa"; } if (GUI. button (new Rect (Highscoresbutton), "sports Car")) {audio. Playoneshot (beep); Menupage = "main"; Startcoroutine ("Buttonaction", "Loading2"); Menupage = "INSTRUCTIONSB"; } if (GUI. button (new Rect (Instructionsbutton), "Challenge Mode")) {audio. Playoneshot (beep); Menupage = "Main "; Startcoroutine ("Buttonaction", "Loading3"); Menupage = "INSTRUCTIONSC"; } if (GUI. button (new Rect (Quitbutton), "back")) {audio. Playoneshot (beep); Menupage = "main"; }} GUI. Endgroup (); } IEnumerator buttonaction (string levelname) {audio. Playoneshot (beep); Yield return new waitforseconds (0.35f); if (levelname!= "quit") {Application.loadlevel (levelname); } else {application.quit (); Debug.Log ("have Quit"); }}//update is called once per framevoid update () {}}
sort of stuff.
Link: http://pan.baidu.com/s/1gdxYZnl Password: 3TU2
The position size of some parameter menu can be adjusted by itself
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Exquisite Cup unity development experience--Start menu GUI production