Hello,
I want to hide the cursor as I am using a gamepad instead of mouse and keyboard.
Would this code 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
8 Answers
8
Yoerick
2
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:
void Start ()
{
Screen.showCursor = false;
}
(in C#)
or:
function Start ()
{
Screen.showCursor = false;
}
(in JavaScript)
If you also want to hide the cursor AND lock it in the center of the screen, you should use
Screen.lockCursor = true;
For those using unity 5 or above, Its “Cursor.visble = false;” (C#) to hide the cursor.
//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 () {
}
}
ive never coded can some one tell me where to add this script or how to please
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;
}
}
‘Cursor.visible = false;’ with the correct spelling
Not sure who asked but yeah, to lock cursor in the middle of the screen using UNITY:
Cursor.lockState = CursorLockMode.Locked;
@Spy4812 please don't post a new question as a comment or answer.
– perchik