- Home /
Question by
Digital-Phantom · Dec 23, 2014 at 11:19 AM ·
guicursoronmouseoverscreen.lockcursor
How do I get OnMouseOver to work again ?
It seems (from reading the forums) that Screen.LockCursor also disables OnMouseOver. Is there anyway around this problem? I want the cursor hidden during gameplay but I also 'need' the player to have the OnMouseOver ability as I have clues and game info scattered around the game area that work with popup GUI text/images.
This is the code I was trying to use-
#pragma strict
var crosshairTex : Texture; // Crosshair texture goes here
var position : Rect; // Position of the crosshair
static var OriginalOn = true;
function Start ()
{
Screen.lockCursor = true;
}
function Update ()
{
position = Rect((Screen.width - crosshairTex.width)/2, (Screen.height - crosshairTex.height)/2, crosshairTex.width, crosshairTex.height);
// Determines the width/height of our crosshair position
}
function OnGUI ()
{
if (OriginalOn == true)
{
GUI.DrawTexture(position, crosshairTex); // Draws the crosshair texture
Screen.showCursor = false; // Disables the cursor from being visable
}
}
Any suggestions ???
Comment
Nobody got any ideas?
Is there maybe another way to hide the cursor and lock it without using Screen.LockCursor that will enable the On$$anonymous$$ouseOver function to still work?
Your answer
![](https://koobas.hobune.stream/wayback/20220613174724im_/https://answers.unity.com/themes/thub/images/avi.jpg)