How can I hide mouse cursor?

Well,This is my first topic here and I want to ask how to hide mouse cursor? :P

Use this line in a script:

Screen.showCursor = false;

5 Likes

:smile: Oh! Thanks.

Hi. I stumbled apon this thread with no idea how to 1. insert this into either a blank script which I dont know how to make or put it into an existing script and the how to insert it into the game itself. please help

[quote=“DerpyMudkip”, post:4, topic: 391125]
Hi. I stumbled apon this thread with no idea how to 1. insert this into either a blank script which I dont know how to make or put it into an existing script and the how to insert it into the game itself. please help
[/quote]

make a new thread, be more clear = answers.

[quote=“DerpyMudkip”, post:4, topic: 391125]
Hi. I stumbled apon this thread with no idea how to 1. insert this into either a blank script which I dont know how to make or put it into an existing script and the how to insert it into the game itself. please help
[/quote]

Perhaps you first need to learn how to create new scripts and how Unity works.
Here is a good starting point, http://unity3d.com/support/documentation/
Also have a look on the forum for “getting started” topics, like this one, http://forum.unity3d.com/threads/113937-Getting-Started-with-Coding-for-Unity

1 Like

thx fehaar i need that to :)

But still... might as well answer his question (or link an answer) instead of forcing others to make a new thread. How do you do this?

[quote=“jpthek9”, post:8, topic: 391125]
But still… might as well answer his question (or link an answer) instead of forcing others to make a new thread. How do you do this?
[/quote]

This thread is over a year old and his point is fair. If you’re posting in a Scripting forum and you don’t know how to make a new script then you need to go do some basic tutorials to learn Unity’s workflow.

so would that look something like this

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

In Unity 5.0 +

Cursor.visible = false;

13 Likes

I use this script .

using UnityEngine;
using System.Collections;

public class kursor : MonoBehaviour {

// Use this for initialization
void Start () {

Cursor.visible = true;
}

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

if(Input.GetButtonDown("Cancel")){
Cursor.visible = true;
}
if(Input.GetButtonDown("Fire1")){
Cursor.visible = false;
}

}
}

2 Likes

I think you should also lock the cursor when hidden.

1 Like

Code tags