- Home /
Using custom cursor texture with Cursor.SetCursor() is not working on Mac
Hi, everyone.
I want to use a custom cursor texture in a Standalone application with Unity and I found out that it can be done with Cursor.SetCursor().
It works pretty cool with Windows, but when I test it on Mac the texture it's drawn badly and it looks like it's broken. In Linux the cursor is shown with the system cursor and the custom texture, both at the same time.
Mac
Linux
Here is the code I'm using:
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 because of the texture settings or what. I've already set the Texture Type to "Cursor" and it's not working.
Does anybody have an advice?
Answer by ExplodingCookie · Aug 23, 2013 at 06:37 PM
Recently, Unity has the default cursor option in the player settings. This sets that texture as the cursor. As for the poor drawing, What is the quality setting that your are using? (Fast, Fastest, Good, etc). BTW Posting a picture of the issue would help a lot.
I'm using the default quality settings for a Standalone app: "Good"
I've updated the op with the images
Thank you
How would you apply this script so I can try to replicate the issue.
It is applied to a simple Plane with a texture in the scene. The script just have the On$$anonymous$$ouseEnter and On$$anonymous$$ouseExit to change the cursor whenever it hovers the plane in the screen.
The texture changes, but it is shown wrong in both examples ($$anonymous$$ac and Linux).
Issue replicated. The fix is to change the texture type to Texture.
Oh, nice! Thank you very much.
It's working in both Windows and $$anonymous$$ac. But it's still showing both cursors in Linux. $$anonymous$$aybe that's another issue, I guess.
Answer by Andre-Odendaal · May 11, 2016 at 01:40 PM
As @maccesch said "On newer versions of Unity you have to set the texture type to "Cursor"."