Cursor.SetCursor() shows both system and custom cursors at the same time in Linux

Hello,

I’m using Cursor.SetCursor() to set a custom cursor when it hovers a plane in the scene.

It is working fine in Windows and Mac, but in Linux it’s showing both cursors at the same time (system and custom cursors).

Here are the images that show the problem

alt text alt text

I’m using this code in my script

public Texture2D cursorTexture;
 
void OnMouseEnter()
{
    Cursor.SetCursor(cursorTexture, new Vector2(5,0), CursorMode.Auto);
}
 
void OnMouseExit()
{
    Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
}

I don’t know if it’s Unity bug, a Linux problem or what.

Does anybody have any advice?

I just tried that and it works fine for me. Can you make a bug report including a repro project?
Thanks!

I just tested my game on another guys machine with him using Linux, and the same thing is happening for me. Except mine is even worse.

Not only does it show both the regular system cursor AND the custom cursor, my custom cursor is HUGE. On Windows my custom cursor is the size of a normal “white” 15 px X 15 px cursor (relatively small). In Linux, when my game runs, my custom cursor is the size of someone’s head in real life. It’s humongous lol.

Any ideas what’s cuasing this?

I’m going to necro this thread, because the same issue happened in my Linux Mint 18 build on Unity 2017.3.

In my case the problem was that I set a custom cursor using Cursor.SetCursor(myTexture, hotspot, mode)
then in the same function on the next line of code I made the cursor visible and unlocked using:

Cursor.visible = true

Cursor.Lockstate = None

It seems that if you set the Cursor visible AFTER setting a custom cursor with set cursor, it makes the custom cursor AND the default cursor visible.

My simple fix was to set the Cursor visible and unlock it BEFORE setting the cursor texture, hotspot, and mode.

I was not using any of the automatic Mouse Events or Pointer events in my code.

Hope this helps someone.