Hardware Cursor works on editor but not on build

Im on a Mac Mini and if i put my mouse over the in game windows i get the hardware cursor i set on Player settings, but i get the default mouse when I hover over the game on a build…

Any ideas?

EDIT:
Ive debugged this code and it actually goes through the single line on the Start event, yet i get no change on the cursor.
This is the code:

using UnityEngine;
using System.Collections;

public class CursorAsignation : MonoBehaviour {
	public Texture2D cursorTexture;
	public CursorMode cursorMode = CursorMode.Auto;
	public Vector2 hotSpot = Vector2.zero;
	
	void Start () {
	    // when we mouse over this object, set the cursor
	    Cursor.SetCursor(cursorTexture, hotSpot, cursorMode);
	}
}

Im aware this is a new feature recently added, but its weird it doesnt work correctly :S

Nothing? I really need some help with this issue

3 Answers

3

Remember to set the texture type to “Cursor” in the Inspector.

41687-texturetypecursor.png

Thanks man. That was my problem.

It only seems to work properly if you assign the cursor in code using SetCursor in a Start or Awake function.

I tried this method and I get the default MacOS cursor both on editor and build. Changed it to set cursor on Update (for testing purposes) and I got my custom cursor on the editor, but when i made a build and tested it, i got a blank cursor.

Make sure the Start function is actually running and the code is correct, and also that the texture is the correct format. I've tried it too and it works well.

The texture is a PNG and I dont know exactly what format it should be, Ive also added the code I use to set the cursor... Thanks for the help man I really appreciate it =)

I'm referring to the texture type in Unity, not the source format. Namely, "Cursor", as opposed to "GUI", "Texture", etc.

I tried your code, by the way, and it works, so that's not the issue.

I wish I had figured out the Cursor texture type in my last project. I spent a bunch of time scripting the cursor when all I had to do was change that one setting.