Hiding the cursor on a certain level. Pause Menu help.

I have three levels to my game, the title screen, the controls menu, and the actual game menu, and I’m trying to work off this scrip for a pause menu.

function Update () {

//hide the cursor (at the beginning of the game)

Screen.showCursor = false;
}

My problem is that when I have this script attached, It takes the cursor away for all three levels, when I only want the cursor to be disabled for the game level. How do I make it so that the cursor is visible for the title, and the controls menu, but not the Game. Also, since this Is also being used for a Pause menu i’m trying to work on, I have another question.

How do I get two 3d textures to pop up when I press escape? also one last thing. I have a script that should make the cursor appear when the escape button is pressed, but I’m not sure what to attach it to.

var script = GetComponent(“HideCursorScript”);

script.enabled = false;

What the cursor-hiding script is attached to? Try my script and attach it to the terrain or empty gameobject

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

function Update () 
{
 if (Input.GetKey (KeyCode.Tab)) //when you press tab it will unlock the mouse
 {
     Screen.lockCursor = false; //the cursor is unlocked from center
     Screen.showCursor = true;  //cursor is visible
 }   
 else
 {
      Screen.lockCursor = true; //the cursor is locked to center
      Screen.showCursor = false; //cursor is invisibe
 }

}

If this helped you please dont forget to press the like :slight_smile:

V2:Press esc to unlock mouse from center and make it visible + lock camera movement, then press esc again to unlock.

private var isPaused = false; 

function Update () {
	
	Lock();

    if(Input.GetKeyDown("escape") && !isPaused)

    {
        cursorlock = false;
        isPaused = true;
        GetComponent(MouseLook).enabled = false;
        GameObject.Find("First Person Controller").GetComponent(MouseLook).enabled = false;

    }

    else if(Input.GetKeyDown("escape") && isPaused)

    {	
        isPaused = false;
        GetComponent(MouseLook).enabled = true;
        GameObject.Find("First Person Controller").GetComponent(MouseLook).enabled = true;      

    }

}

function Lock () {

	if (isPaused)
 {
     Screen.lockCursor = false; 
     Screen.showCursor = true;  
 }   
 	if(!isPaused)
 {
      Screen.lockCursor = true;
      Screen.showCursor = false;
 }
 
}

i agree with riko4628 , this is probs the best way to get around this.