Question by
djanthony93 · Oct 09, 2016 at 12:31 AM ·
scripting problemmouse
Cursor.visible doesn't work after project build
This is my PauseMenu script:
void Start () {
menu.gameObject.SetActive(false);
Cursor.visible = false;
}
void Update () {
if(Input.GetKeyDown(KeyCode.Escape) && !menu.gameObject.activeInHierarchy){
Cursor.visible = !Cursor.visible;
Debug.Log("Escape pressed");
Pause();
}
}
When I play and press Escape the pause menu will be displayed and toggle the cursor on. It work only in Unity.
Fun fact: Cursor.visible works in my first scene, then when a new scene is loaded it doesn't work anymore.
Comment
Your answer
Follow this Question
Related Questions
How would i change my mouse cursor in between scenes 0 Answers
Needing help with 3rd person mouse camera 1 Answer
ScreenToWorldPoint not working with cinemachine virtual camera 1 Answer
How to tilt a sprite based on pointer position? 1 Answer
How to get only one object to select at a time (in game)? 1 Answer