Cursor Reappears at Random

Hi all,

My game is running in Full Screen by default, and my “Mac Fullscreen Mode” in Player Settings is set to “Fullscreen Window with Menu Bar and Dock.” These are the settings I want to use, as they’re the most standard and user-friendly.

I’m hiding the system cursor like so:

Cursor.visible = false;

However, the system cursor will often come back, either at random, or when moving the the cursor up into the menu bar or down into the dock. I would expect it to return when going to one of these sections, but it never disappears again; Cursor.visible is still set to false, despite the cursor clearly being visible.

The only workaround I’ve found is to create an empty texture and set it as the “Default Cursor” in Player Settings. Thus, the system cursor is being replaced by the empty texture, and will not be drawn while the game is active. Unfortunately, the cursor will not even be drawn when you move it up to the menu bar or down to the dock. Apple wasn’t a fan of this, so at their request I left “Default Cursor” set to None, and right now Mac App Store players have to deal with the cursor randomly coming back. (Of course, Apple doesn’t like that the cursor randomly appears, either. It’s lose-lose.)

This is an extremely common issue that I’ve noticed in most (all?) major Unity games on Mac (Kentucky Route Zero comes to mind). Has anyone found a workaround? Is this a bug?

Thanks!

  • David

It should work if you set Cursor.visible to false every frame.

–Eric

1 Like

Alas, I tried that with no luck.

Hmm, well, that was my only idea. :wink: Just for the record, I dislike Fullscreen Window with Menu Bar and Dock, and find the menu and dock popping up when moving the mouse around really annoying. Fullscreen Window is basically fine…it’s true it doesn’t allow Command-Tab, but you can always Command-F to toggle windowed mode, so it’s not much of an issue.

–Eric

Instead of Cursor.visible = false, have you tried Screen.lockCursor = true?

@Eric5h5 : I’ll keep Fullscreen Window in mind. It’s not exactly the solution I’d like, but it gets me most of the way there. Thanks!

@JoeStrout : Looks like Screen.lockCursor is obsolete, though I could use Cursor.lockState. I’m using Input.mousePosition to map my in-game cursor however, so I’d have to switch to Input.getAxis or something in order to make that work. It’s something to consider. In the meantime, I’ll file a bug report since this is really easily repeatable.

1 Like

Bug report, for those interested: https://fogbugz.unity3d.com/default.asp?858220_05167ol9q7kku7it

Quick update to say the the bug was reproduced and forward to the Unity devs on 12.7. I’m not sure if there is a fix or if it has made it into a recent update.

Another quick update to say that the bug is still present in Unity 5.5.2p2. Contacted Unity about it, but haven’t heard back yet.

Have you solved the issue? This things is really annoying and still persist

1 Like