Can't see mouse after removing it

Here is my problem,
I have a script that among other things removes the mouse, so it’s not annoyingly sitting in the middle of the screen.
Here it is, and it works just how I want it to

#pragma strict
@script RequireComponent ( AudioSource )
var papers : int = 0;
var papersToWin = 5;
var distanceToPaper : float = 2.5;
public var paperPickup : AudioClip;
function Start ()
{
Screen.lockCursor = true;
}
function Update ()
{
if(Input.GetMouseButtonDown (0) || Input.GetKeyDown (KeyCode.E))
{
var ray = Camera.main.ScreenPointToRay(Vector3(Screen.width * 0.5,
Screen.height * 0.5, 0.0));
var hit : RaycastHit;
if(Physics.Raycast(ray, hit, distanceToPaper))
{
if(hit.collider.gameObject.name == "Secret")
{
papers += 1;
GetComponent.<AudioSource>().PlayClipAtPoint(paperPickup, transform.position);
Destroy(hit.collider.gameObject);
}
}
}
}
function OnGUI ()
{
if(papers < papersToWin)
{
GUI.Box(Rect((Screen.width * 0.0) -0, 0, 0, 0), "  " + papers.ToString() + " - Demo");
}
else
GUI.Box(Rect((Screen.width/2) -100, 45, 200, 35), "All Secrets Found!");
}

The problem is when I switch from the game back to any level where I do want the cursor available, for instance, at the end of my game, it goes back to the main menu, where I do not have the script on the main camera, however the mouse is still gone, and I can’t get it to come back.

Would I add a new script on the level I want the mouse back with “screen.lockcursor = false;” ?
Can anyone show me, or tell me a way to do this? Thank you so much!

If you were to switch the scene back to the main menu or any scene which requires the mouse cursor you would simply remove this current script and create a new one which does the following:

Unity 4 API

function Start () {

Screen.showCursor = true;

}

Unity 5 API

function Start () {

Cursor.visible = true;

}

Of course if you wished the mouse cursor to appear in the same scene after it was deactivated you would have to re-enable it through a function in game and switch it back again when done. I hope this helped. :slight_smile: