- Home /
How to reset default cursor pointer after using a custom one?
Hi.
I've used this:
Cursor.SetCursor(crosshairs, Vector2.zero, CursorMode.Auto);
to use a custom cursor, but can't seem to find the code to restore the default cursor. Any suggestions?
Thank you.
Try to go to player setting and change or restore defualt cursor.....but first delet the code and the custom cursor texture
You are right... I didn't provided enough information in order to get some useful answers, but thank you anyway.
Answer by Ericool · Dec 17, 2014 at 01:46 AM
At Start() , get the default texture
//Resets the cursor to the default
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
I used this, but it only worked after clicking another application then clicking on the game again to render the cursor on OSX unity standalone.
Answer by codemaker2015 · Jul 01, 2021 at 12:10 PM
The default cursor settings in the player settings worked in the editor but it did not show up in a build. Also limiting the texture size to 32x32. I resolved this issue by using Cursor.SetCursor method in a script to change the cursor.
[SerializeField] Texture2D cursor;
void Start() {
Cursor.SetCursor(cursor, Vector3.zero, CursorMode.ForceSoftware);
}