# Unity 5 - Mouse Disappears during runtime

My mouse cursor disappears during runtime. When I click esc, it appears and the moment I click on something, it disappears again. This is what I have done so far to fix this. I have added this to a script on an empty gameobject in my scene.

void Start()
{
Cursor.visible = true;
}


The problem persists and so I added the code to the update function. Still the same. I do not understand what am I missing here. Why is the cursor disappearing the moment I click and why doesn't it appear automatically onStart during runtime? I have also tried to implement a custom cursor and the same problem again. I am using 5.3.2f. I hope someone can point me in the right direction. Cant find a solution in any forums.

Okay so I have fixed this. Hopefully this answer will help someone else. Okay if you look at this script MouseLook.cs under StandardAssets/Characters/FirstPersonCharacters/Scripts/. Go to lines 83,88,89.

Make the following changes :

m_cursorIsLocked = true;(line 83) change to 'false'

 Cursor.lockState = CursorLockMode.Locked; (line 88) change to 'none'
Cursor.visible = false; (line 89) change to 'true'


I think its pretty self explanatory what this does. Line 83 set m_cursorIsLocked to true whenever I clicked my mouse. Line 88 used m_cursorIsLocked as a condition to set my cursor lockmode to Locked and my cursor to invisible. Thast why even when I added Cursor.visible = true in my update function, it still did not work since MouseLook.cs was constantly turning my cursor to invisible. Anyways I cannot guarantee that these changes will not cause any other issues. This is because this script is being referred to by other scripts. But so far so good, everything works fine. Thanks.

• You'd want to lock the cursor for something like a first person shooter. You don't want the cursor to show up and you don't want it to leave the game window. Locking and hiding the mouse allows you to look around, without worrying about losing control of the mouse. Thanks for posting your solution. – MichaelHouse May 5 '16 at 20:45