# How to hide the cursor

**URL:** <https://discussions.unity.com/t/how-to-hide-the-cursor/9866>\
**Category:** Questions & Answers\
**Created:** [November 11, 2010, 1:49am UTC](https://discussions.unity.com/t/how-to-hide-the-cursor/9866 "2010-11-11T01:49:56Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon17387017](https://avatars.discourse-cdn.com/v4/letter/a/f17d59/32.png) [@anon17387017](https://discussions.unity.com/u/anon17387017)\
**Post date:** [November 11, 2010, 1:49am UTC](https://discussions.unity.com/t/how-to-hide-the-cursor/9866/1 "2010-11-11T01:49:56Z")

</div>

Hello,

I want to hide the cursor as I am using a gamepad instead of mouse and keyboard.

Would this [code](http://unity3d.com/support/documentation/ScriptReference/Screen-showCursor.html) work for that:

Screen.showCursor = false;

and if so where show it go?

I am really new, and have no experience coding (dont really know how i made it this far)

Cheers,

Sabrina

---

<div class="post-metadata">

**Author:** ![Yoerick](https://avatars.discourse-cdn.com/v4/letter/y/5daacb/32.png) [@Yoerick](https://discussions.unity.com/u/Yoerick)\
**Post date:** [November 11, 2010, 11:27am UTC](https://discussions.unity.com/t/how-to-hide-the-cursor/9866/2 "2010-11-11T11:27:21Z")

</div>

If you want to hide the cursor through the entire game you should add the "Screen.showCursor = false"-code inside the Start function ;)

like so:

```auto
void Start ()
{
    Screen.showCursor = false;
}

```

(in C#)

or:

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

```

(in JavaScript)

---

<div class="post-metadata">

**Author:** ![Al-Anselmo](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/al-anselmo/32/439733_2.png) [@Al-Anselmo](https://discussions.unity.com/u/Al-Anselmo)\
**Post date:** [December 27, 2010, 2:01am UTC](https://discussions.unity.com/t/how-to-hide-the-cursor/9866/3 "2010-12-27T02:01:37Z")

</div>

If you also want to hide the cursor AND _lock_ it in the center of the screen, you should use

> Screen.lockCursor = true;

---

<div class="post-metadata">

**Author:** ![sillyjake](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@sillyjake](https://discussions.unity.com/u/sillyjake)\
**Post date:** [June 28, 2015, 8:50pm UTC](https://discussions.unity.com/t/how-to-hide-the-cursor/9866/6 "2015-06-28T20:50:10Z")

</div>

For those using unity 5 or above, Its “Cursor.visble = false;” (C#) to hide the cursor.

---

<div class="post-metadata">

**Author:** ![waqar1world](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/waqar1world/32/245506_2.png) [@waqar1world](https://discussions.unity.com/u/waqar1world)\
**Post date:** [August 27, 2015, 2:28pm UTC](https://discussions.unity.com/t/how-to-hide-the-cursor/9866/8 "2015-08-27T14:28:50Z")

</div>

//for Unity3d 5  
using UnityEngine;  
using System.Collections;

public class CurserRemove : MonoBehaviour {

```
// Use this for initialization
void Start () {
	Cursor.visible = false;

}

// Update is called once per frame
void Update () {

}

```

}

---

<div class="post-metadata">

**Author:** ![BearMan11](https://avatars.discourse-cdn.com/v4/letter/b/bc8723/32.png) [@BearMan11](https://discussions.unity.com/u/BearMan11)\
**Post date:** [December 23, 2012, 10:33am UTC](https://discussions.unity.com/t/how-to-hide-the-cursor/9866/4 "2012-12-23T10:33:40Z")

</div>

ive never coded can some one tell me where to add this script or how to please

---

<div class="post-metadata">

**Author:** ![Assassin2248](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@Assassin2248](https://discussions.unity.com/u/Assassin2248)\
**Post date:** [May 30, 2013, 8:15am UTC](https://discussions.unity.com/t/how-to-hide-the-cursor/9866/5 "2013-05-30T08:15:59Z")

</div>

To remove your mouse from the screen, create a neew c# script and then clear everything out of it  
the copy and paste the following into the script:

```
using UnityEngine;
using System.Collections;

public class CursorDelete : MonoBehaviour {
void Start ()
    {
    Screen.showCursor = false;
    Screen.lockCursor = true;
	}
}

```

---

<div class="post-metadata">

**Author:** ![Half\_Res](https://avatars.discourse-cdn.com/v4/letter/h/8edcca/32.png) [@Half\_Res](https://discussions.unity.com/u/Half_Res)\
**Post date:** [July 23, 2015, 5:09pm UTC](https://discussions.unity.com/t/how-to-hide-the-cursor/9866/7 "2015-07-23T17:09:48Z")

</div>

‘Cursor.visible = false;’ with the correct spelling

---

<div class="post-metadata">

**Author:** ![Tarookie16](https://avatars.discourse-cdn.com/v4/letter/t/7feea3/32.png) [@Tarookie16](https://discussions.unity.com/u/Tarookie16)\
**Post date:** [January 19, 2022, 9:09am UTC](https://discussions.unity.com/t/how-to-hide-the-cursor/9866/9 "2022-01-19T09:09:18Z")

</div>

Not sure who asked but yeah, to lock cursor in the middle of the screen using UNITY:  
Cursor.lockState = CursorLockMode.Locked;
