turn off script with a key..

hey i have a script that locks the mouse i need the script to turn off when i press escape then turn back on when i re press it, the escape button is what gets me into the menu… the script i have it… any ideas?? or re writes to it… to fix my issue

function Update () {
Screen.showCursor = false;
Screen.lockCursor = true;
Screen.lockCursor = false;
}
var paused : boolean = false;
function Update () 
{ 
   if(Input.GetKeyDown("escape")
   {
      paused  = !paused ;
      if(paused) //Do Stuff When Paused
      {
          Screen.showCursor = true; 
      }
      else // Do stuff when unpaused
      {
          Screen.showCursor = false; 
      }             
   }
}

first of all you have 2 Update methods in one script which wont work, I think what you wanted to do is :

function Start() {
Screen.showCursor = false;
Screen.lockCursor = true;
Screen.lockCursor = false;
}

and here : if(Input.GetKeyDown(“escape”) youre missing a closing ‘)’ bracket so it should be :

if(Input.GetKeyDown("escape"))

and it should work :slight_smile: