Hey, I’m using an ingame menu script that is supposed to have this actions - Resume,Quit,Restart,Main Menu… Resume and Quit works fine but I can’t get Restart and Main Menu to work in standalone pc format. Anyone know why these commands won’t work in standalone pc format?
Here is the script:
var guiSkin: GUISkin;
var nativeVerticalResolution = 700.0;
var isPaused : boolean = false;
Screen.showCursor = false;
function Update()
{
if(Input.GetKeyDown("escape") && !isPaused)
{
print("Paused");
Time.timeScale = 0.0;
isPaused = true;
Screen.showCursor = true;
}
else if(Input.GetKeyDown("escape") && isPaused)
{
print("Unpaused");
Time.timeScale = 1.0;
isPaused = false;
Screen.showCursor = false;
}
}
function OnGUI ()
{
// Set up gui skin
GUI.skin = guiSkin;
// Our GUI is laid out for a 1920 x 1200 pixel display (16:10 aspect). The next line makes sure it rescales nicely to other resolutions.
GUI.matrix = Matrix4x4.TRS (Vector3(0, 0, 0), Quaternion.identity, Vector3 (Screen.height / nativeVerticalResolution, Screen.height / nativeVerticalResolution, 1));
if(isPaused)
{
// RenderSettings.fogDensity = 1;
if(GUI.Button (Rect((Screen.width)/3,540,200,75), "Quit", "button2"))
{
print("Quit!");
Application.Quit();
}
if(GUI.Button (Rect((Screen.width)/3,440,270,75), "Restart", "button2"))
{
print("Restart");
Application.loadedLevel("");
Time.timeScale = 1.0;
isPaused = false;
}
if(GUI.Button (Rect((Screen.width)/3,340,310,80), "Main Menu", "button2"))
{
print("Main Menu");
Application.LoadLevel("0");
}
if(GUI.Button (Rect((Screen.width)/3,240,270,75), "Continue", "button2"))
{
print("Continue");
Time.timeScale = 1.0;
isPaused = false;
Screen.showCursor = false;
}
}
}
@script AddComponentMenu ("GUI/Pause GUI")