Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: Lane on March 05, 2015, 12:18:33 PM

Title: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)
Post by: Lane on March 05, 2015, 12:18:33 PM
Unity 5 depreciates some code for Set Mouse Cursor and handles Cursors a bit differently. This should meet your needs when replacing the Set Mouse Cursor action.

I've had some mixed results with the Cursor visibility, so please report any problems with the action along with relevant hardware/software info.
Title: Re: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)
Post by: Roger Lee on March 24, 2015, 10:52:52 PM
Thank you, I came in here today looking for this very thing!!
Title: Re: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)
Post by: stigma on April 04, 2015, 01:05:39 PM
I used Set Mouse Cursor with Set Mode cursor and I have some problem with any scene. For example, it's doesn't works in main scene but it's ok for other scene.
Title: Re: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)
Post by: Lane on April 04, 2015, 02:46:39 PM
It seems there are some issues with the new cursor stuff in Unity 5, but no one has tracked them down yet.
Title: Re: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)
Post by: fuzzywobs on May 03, 2015, 12:13:38 PM
Sorry to be a noob, but how would one apply the workaround? I've tried adding the script to my character controller but it is telling me it needs to be dreived from a Monobehaviour.

Thanks,
Title: Re: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)
Post by: Lane on May 03, 2015, 12:49:42 PM
Just drag it into your project folder and it'll appear in the Playmaker Action List.
Title: Re: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)
Post by: mdotstrange on May 28, 2015, 10:42:54 PM
Thanks so much for this Lane!
Title: Re: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)
Post by: Mentalcase on June 18, 2015, 11:28:37 AM
I am using this action, but when I test it in the editor, the cursor will jump to the pause button or to the center of a different window in the editor whenever it hovers over an object with a Mouse Pick Event action (at least that seems to be the reason). Any ideas?
Title: Re: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)
Post by: Lane on June 18, 2015, 11:47:56 AM
Hmm, not really.

There seem to be some problems with the new way Unity handles cursor locking and there isn't much documentation even still. I assume its an issue with varying hardware because not everyone exhibits the same issues, or any issues at all. Often this works just fine so its kind of hard to figure out whats wrong but it doesn't seem to be related to the action from what I can tell and have read on the Unity forums.
Title: Re: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)
Post by: Mentalcase on June 18, 2015, 12:25:05 PM
Ok, I found that it is actually when I go to my reset state on mouse off, it sends an event to my cursor fsm to set it back to default. I have things set up very similar to the "No Exit" Playmaker example. I will also try opening the project on a different machine in case it's a hardware issue. Thank you for the quick response   ;D
Title: Re: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)
Post by: Mentalcase on June 18, 2015, 12:47:50 PM
Yeah, it seems to be hardware related. I will try it on a another PC tonight to be sure, but everything worked perfectly on mac. There was another issue that I have been having with the cursor that didn't seem present on the mac. Thank you for the help.
Title: Re: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)
Post by: Mentalcase on June 23, 2015, 11:25:26 AM
So I tried it on another PC and I was having the exact same problem, but it may be a combined issue with the cursor not behaving properly. This is when I test the game in windowed mode in the editor; it seems to work fine in full screen. I have found some posts online about some people having issues with the cursor in Unity 5 on PC.
Title: Re: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)
Post by: Lane on June 23, 2015, 11:59:27 AM
Interesting, thanks for following up.
Title: Re: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)
Post by: Game Daddy on July 02, 2015, 04:15:50 AM
Unity 5.1.1 released with a cursor fix for Windows I believe.
Title: Re: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)
Post by: Lane on July 02, 2015, 11:23:30 AM
Unity 5.1.1 released with a cursor fix for Windows I believe.

I glanced through the patch notes but haven't found anything on it, still seems to be acting up for me.
Title: Re: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)
Post by: wheretheidivides on July 21, 2015, 10: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'.
Title: Re: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)
Post by: Lane on July 21, 2015, 10: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.
Title: Re: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)
Post by: LogLady on November 04, 2015, 02: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!
Title: Re: Set Cursor Mode - Replacement for Set Mouse Cursor (Unity 5)
Post by: Lane on November 05, 2015, 07: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.