I’ve got a clickable GUITexture, but I would like it to be treated as a regular button both in Unity Player and in standalone builds. Is there a way to change the mouse cursor to a hand cursor programatically? And no, calling external JavaScript is not a solution for me as it will only work in browsers.
Maybe creating some “standard” Unity button with with the skin property set to none would help?
Any ideas?
It can definitely be done. Check out this app. When starting a drag the feedback icon is following the mouse pointer. This is done using GUI.Label and its ‘normal’ skin.
Thank you for your reply, but it’s not what I meant.
I know how to make something follow the mouse pointer, but I don’t know is how to make the mouse pointer change into a hand pointer, which indicates that something is clickable. And I’m not looking into a workaround like hiding the mouse cursor and displaying a png icon in its position, but to actually use the system hand cursor.
For instance, please now rollover the “Reply to Thread” button here on this page. When you do this, your mouse pointer transforms into a hand cursor. When you rollout, it becomes an “arrow”. A regular button behaviour. I would like to achieve the same in unity, having a GUITexture with the OnMouseEnter etc. handlers.
Well, the way this is usually done with applets (Flash etc.) is to hide the system cursor and implement your own. This way you got a much greater freedom. You can render virtually anything instead of the cursor.
OK, there is a slight delay when implementing your own, but… it’s generally fine. Don’t be such a purist
btw In the previous example I didn’t want to hide the original cursor.
ergh… it’s a pity we can’t manipulate the actual OS cursor. In Flash it’s very simple. You just type spriteInstance.useHandCursor = true; and that’s it. Making something follow the mouse with the mouse cursor hidden is, as you say, sometimes slow. Also, if the user changed his OS cursor to some fancy image, he’ll be confused when seeing a traditional hand cursor when rolling over a button.
As far as such policy may be acceptable for games, where you nearly always have a custom GUI, it is at least inconvenient if we talk about web.
Anyway, thank you for your reply, at least now I know it’s just not possible
This is a huge surprise to me. Seriously?! As Magic said, it was so simple with Flash and Shockwave that I’m just having trouble believing that my beloved Unity can’t do it.