I am trying to make a button (LeftAlt) that will set the timeScale to 0 and show/unlock the cursor but my script isn’t working, here is my script (JavaScript):
var p = 0;
function Update () {
if (Input.GetKeyDown(KeyCode.LeftAlt) && p == 0)
{
Time.timeScale=0;
Screen.showCursor = true;
Screen.lockCursor = false;
p = 1;
}
if (Input.GetKeyDown(KeyCode.LeftAlt) && p == 1)
{
Time.timeScale=1.0;
p=0;
}
}