playMaker

Author Topic: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)  (Read 12032 times)

wheretheidivides

  • Sr. Member
  • ****
  • Posts: 496
    • View Profile
Re: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)
« Reply #15 on: July 21, 2015, 07:20:01 AM »
I'm using unity 5.1.1p4 with windows 8.1.

On the main menu (capture.jpg), it is set to change to a ball and turn.  It does this fine.

When clicking on a button and going to another scene, the cursor locks up.  It gets confined to the center of the screen.  I have to pause the game, then unpause the game to get the cursor moving again.  I have tried the different settings on the action and it still freezes the cursor (like the lock mode).



the 'hide cursor' setting is a bit deceiving.  Does this mean if checks it hides it?  or does it mean 'see the cursor'.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)
« Reply #16 on: July 21, 2015, 07:34:58 AM »
Toggle fields are always boolean; the statement is true when checked and false when unchecked.

Not sure whats up with the changing scenes issue.

LogLady

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Re: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)
« Reply #17 on: November 04, 2015, 12:26:21 PM »
Lane, this action is not working on Unity 5.2.2f1. I tried on 3 different computers and got no results as the mouse kept going off the game screen and losing focus when the mouse button is pressed. I found this script here and it is working: http://answers.unity3d.com/questions/913318/lock-cursor-problem-in-unity-3d-5.html

Code: [Select]
     using UnityEngine;
     using System.Collections;
     
     public class HideLockCursorA : MonoBehaviour
     {
     void Start ()
       {
         Cursor.lockState = CursorLockMode.Locked;
         Cursor.visible = false;
       }
                       void Update ()
                 {
                         Cursor.lockState = CursorLockMode.Locked;
                         Cursor.visible = false;
                 }
     }

I hope this can help others!

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)
« Reply #18 on: November 05, 2015, 05:28:58 AM »
The link to the Answers thread shows some using it in Update, but that doesn't work for me. Seems like most people are still finding it buggy.

Try this one. It's got a few options, at least you can narrow down which update types work. Seems to work only in OnGUI with the system I'm on right now.

FYI the original was only firing Once. The UpdateType dropdown gives you the option of firing in a Update, OnGUI, LateUpdate or only Once.
« Last Edit: November 05, 2015, 05:30:53 AM by Lane »