|
Is there a way to change the look of the cursor in game? and have the cursor look differently based on conditions like mouse over? Thanks
(comments are locked)
|
|
These techniques have been rendered obsolete by http://docs.unity3d.com/Documentation/ScriptReference/Cursor.SetCursor.html what about getting the hardware cursor position, Input.mousePosition is still Update dependent afaik
Jan 08 at 10:03 PM
Marrt
Good to know dvochin2
Mar 05 at 03:33 AM
Khada
(comments are locked)
|
|
Just go into project settings > Player > and set the cursor to whatever, then code it. Happy Developing!
(comments are locked)
|
|
It works fine but you forget to tell one thing: This script draw the new mouse pointer as a GUI element, so it will be in a Layer. You should set the object with is drawing the new cursor in a Layer that will be above the others layers. If you don't do this, you mouse will simply dissapear when you aiming something on the GUI. =)
(comments are locked)
|
|
Ya Unity needs a away to change the hardware cursor. Maybe someone should start a feature request. Unfortunately, I do not think it glamorous enough to get much attention. Software cursors suck even with high frame rates they create a ghosting effect behind the real cursor. Yes, software cursors are no responsive as the hardware ones. But until then, you could perhaps use this: http://edrivenunity.com/cursors
Jul 11 '12 at 04:35 PM
dkozar
(comments are locked)
|
|
There's no built-in function to set a custom mouse cursor, but you can make a script to do it yourself by simply hiding the cursor and drawing your own at the current mouse position. Something like this should work:
Just attach it to a GameObject and drag and drop the image you want to use onto cursorImage. To change the cursor from another script, just change the cursorImage variable. EDIT: As Lance mentioned in the comments below, with this method if your game suffers from low frame rates, the mouse will lag along with everything else. Unfortunately, there is currently no easy way around this that I know of. It's important to know that drawing your own cursor is a software cursor as opposed to the normal one, which is a hardware cursor. What this means is that if your framerate is low or stuttery, moving the cursor won't be smooth. This is opposed to hardware cursors which remain smooth, regardless of CPU load. You might have experienced when your computer hangs, nothing is responsive except your cursor.
Dec 11 '09 at 05:54 AM
Lance Sun
Just an update, as of today there still seem to be no other solution for this issue. +1 for this. Even if it's not best, it's the only. And one thing: maybe it's better to use
Oct 18 '10 at 01:00 PM
Cawas
also, there's a full script here which may interest someone: http://www.unifycommunity.com/wiki/index.php?title=Custom_2D_Pointer
Oct 18 '10 at 02:36 PM
Cawas
(comments are locked)
|
