Unity3D : Pause Menu - Android
Posted
by
user3666251
on Game Development
See other posts from Game Development
or by user3666251
Published on 2014-06-05T20:29:15Z
Indexed on
2014/06/05
21:43 UTC
Read the original article
Hit count: 231
Im making a 2D game for android.I almost completed the game but now I need a pause game option.I added a pause icon on the top right side of the screen.The icon is a gui texture.Here is what I did so far :
I made a script which will bring up some buttons (which is not working) and attached it to the GUITexture.This is the script :
#pragma strict
function OnMouseDown() {
Debug.Log("*Pause Menu Opens*");
Time.timeScale = 0;
if (GUI.Button(Rect(10,10,100,50),"Restart"));
Application.LoadLevel(Application.loadedLevel);
if (GUI.Button(Rect(10,60,100,50),"MainMenu"));
Application.LoadLevel("MainMenu");
}
Now,the problem stands at the part where the buttons won't show up,the game freezes at the first frame but the buttons won't show up.Please,if you can help I would be realy thankful.
Thank you.
Edit #1 : I just noticed that when I click "Pause" the game freezes and it takes me to the MainMenu.That's because I added the GUIButton which takes you to the main menu.I think the whole script structure is wrong.I also forgot to mention that Im new in scripting/unity.
Thank you.
© Game Development or respective owner