|
when quit is opted i want a dialog-box to appear saying "are you sure you wanna quit. yes/no" if no is chosen then i want the game to quit other wise i want the game to resume. how do i program it. i do not know much of programming. please help thanks!
(comments are locked)
|
|
Go to gameobject => create other => 3dText. Create the text you want and got to component=>physics=>boxcollider. Make sure you text is not inside another object as it will show but you won't be able to touch it. Then assign that script below to the GUI object and you are good to go. Now you need to start tweaking the variable to place properly and do exactly what you want. Hope that helps I wanted to post pictures to show the process but I could not...
Jan 30 '12 at 08:32 PM
fafase
HEY THANX!! :)
Jan 31 '12 at 04:39 AM
BLISS
i've this code which opens a gui when i press esc while playing. i want another gui to open which asks for "are you sure you wanna quit " when quit is chosen. how do i do that? var guiSkin: GUISkin; var nativeVerticalResolution = 1200.0; var isPaused : boolean = false; var isquit : boolean = false; function Update() { if(Input.GetKeyDown("escape") && !isPaused) { print("Paused"); Time.timeScale = 0.0; isPaused = true; } else if(Input.GetKeyDown("escape") && isPaused) { print("Unpaused"); Time.timeScale = 1.0; isPaused = false; } } function OnGUI () { // Set up gui skin GUI.skin = guiSkin; } if(isPaused) { GUI.Box (Rect (380,200,300,300), ""); // RenderSettings.fogDensity = 1; if(GUI.Button (Rect((Screen.width)/2,280,140,70), "Quit", "button2")) { if(isquit) { print("Quit!"); Application.LoadLevel("main menu"); } if(GUI.Button (Rect((Screen.width)/2,360,140,70), "Restart", "button2")) { print("Restart"); Application.LoadLevel("SomeLevelHere"); Time.timeScale = 1.0; isPaused = false; } if(GUI.Button (Rect((Screen.width)/2,440,140,70), "Continue", "button2")) { print("Continue"); Time.timeScale = 1.0; isPaused = false; } } @script AddComponentMenu ("GUI/Pause GUI")
Jan 31 '12 at 06:42 AM
BLISS
(comments are locked)
|
