- Home /
Hide custom hardware cursor on iOS in Unity4
Hi all, I have set a custom hardware cursor in the Player Settings. It works fine and all, the only issue is, it works ALSO on the iPad, so when I tap on the screen I see the cursor and it stays where the last touch was made. I don't want this.
I tried
Screen.showCursor = false;
And it works only in the editor. On iOS I see the cursor again. Of course a workaround would be to delete the cursor texture from the Player Settings just before exporting, and then put it back again when i export for desktop, but I'd like to do it via code.
Any idea?
Answer by GerryM · Nov 24, 2012 at 11:08 PM
You could set the cursor to an empty texture when you don't want/need it via SetCursor, e.g. when you are on a handheld device.
Thanks for the tip, it SHOULD have worked, but it didn't at first.
But then I found that the code you hinted was correct (of course, it's the Unity documentation) but the problem is, you need to change cursor in a function other than Start(), otherwise it will change it back to the default one (as detailed here: http://www.41post.com/5049/program$$anonymous$$g/unity-assigning-a-texture-to-the-cursor)
Another detail is that passing a null texture doesn't put the cursor back to the default one, so my way was to have no custom cursor, and only load it on desktop platforms.
So yeah... now it works!
Your answer
![](https://koobas.hobune.stream/wayback/20220613084444im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Restoring Transactions ios, what do I add when the restoration process succeeded? 1 Answer
ERROR: The 'Passive' connection '%appname%' access to protected services is denied. 1 Answer
Mouse move object according to grid 3 Answers
Xcode 11.3 library not found for liphone lib error 0 Answers