Search Unity

How can I hide mouse cursor?

Discussion in 'Scripting' started by liroke, Apr 29, 2009.

  1. liroke

    liroke

    Joined:
    Apr 29, 2009
    Posts:
    39
    Well,This is my first topic here and I want to ask how to hide mouse cursor? :p
     
  2. fehaar

    fehaar

    Joined:
    Mar 1, 2007
    Posts:
    44
    Use this line in a script:

    Screen.showCursor = false;
     
    YBtheS, RaulGPerez, blox5000 and 2 others like this.
  3. liroke

    liroke

    Joined:
    Apr 29, 2009
    Posts:
    39
    :D Oh! Thanks.
     
  4. DerpyMudkip

    DerpyMudkip

    Joined:
    Aug 20, 2012
    Posts:
    1
    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
     
  5. saitoFOX

    saitoFOX

    Joined:
    Jul 10, 2012
    Posts:
    32
    make a new thread, be more clear = answers.
     
  6. Leslie-Young

    Leslie-Young

    Joined:
    Dec 24, 2008
    Posts:
    1,148
    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
     
    Last edited: Aug 20, 2012
    incorrect likes this.
  7. Poulpc

    Poulpc

    Joined:
    Feb 2, 2013
    Posts:
    14
    thx fehaar i need that to :)
     
  8. jpthek9

    jpthek9

    Joined:
    Nov 28, 2013
    Posts:
    944
    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?
     
  9. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    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.
     
  10. 102201

    102201

    Joined:
    Nov 12, 2014
    Posts:
    1
    so would that look something like this
    Code (java):
    1. function Start () {
    2.     Screen.showCursor = false;
    3. }
     
  11. Dziksu

    Dziksu

    Joined:
    Mar 6, 2015
    Posts:
    1
    In Unity 5.0 +

    Cursor.visible = false;
     
    SeanKaat, YBtheS, RaulGPerez and 10 others like this.
  12. Vachtar

    Vachtar

    Joined:
    Apr 19, 2015
    Posts:
    1
    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;
    }


    }
    }
     
    JamieVRcade and (deleted member) like this.
  13. Pumpur

    Pumpur

    Joined:
    Apr 16, 2015
    Posts:
    14
    I think you should also lock the cursor when hidden.
     
    InsaneDuane likes this.
  14. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,741