I got and object in front of my camera. I would like to change cursor style ( from to normal to link - just like a link on www ). That change should be noticed when user will roll over that object… Is it possible?
There’s a script in this thread that shows how to detect an object under the mouse using a raycast.
I apologize for bumping an older topic, but I’m looking for a built-in method to change the cursor to “link” (the pointing hand) and this was the closest post I’ve found in relation.
The poster question still stands – the Editor class seems to have a method (MouseCursor.Link), but other than custom cursors, is there something we can do to enable the “link” cursor when hovering over something clickable?
Thanks for any info!
Not sure what you mean… are you having a problem changing the cursor or detecting the link object under the mouse?
The both of us were looking to have the cursor changed from the normal pointer, to the link (which is the hand cursor you see when mousing over items like a URL). Since the Editor Class has a MouseCursor.Arrow, it implies that the cursor could be something else (such as .Link).
Since such properties are available in the Editor Class, there is a hope that we do not have to use custom cursors just to switch to the hand/link cursor.
I’ve already resorted to the custom cursor which has proven to be a big pain in the buttah working with GUITexture and common mouse-actions. ![]()
I’m looking for the same thing (a simple way to change to the “link” cursor on mouseover). See http://forum.unity3d.com/viewtopic.php?t=46049. It looks like I, too, am going to have to resort to the GUI method.
exactly! …maybe we can use easily like:
function OnMouseEnter(){
MouseCursor.Link;
}
function OnMouseExit(){
MouseCursor.Arrow;
}
…or something like that ![]()
done!
…try this script
//GUIObject.js
var objectLinkScriptIsAttachedTo : GameObject;
private var condition = true;
function OnMouseDown(){
condition = false;
}
function OnGUI(){
if(!condition){
if(GUI.Button(Rect(600,20,50,50),"Link")){
objectLinkScriptIsAttachedTo.GetComponent(OpenLinkURL).OpenLink();
}
EditorGUIUtility.AddCursorRect (Rect(600,20,80,80), MouseCursor.Link);
}
}
Note that this will only work in the Editor. Good lord this topic is old…