Detect Mouse over on gui

HI folks…!!
i need the output as when mouse over the rect position, i have to stop some execution code
so here i am use the code in my project

my code:

var bool = false;
var rr : Rect ;
function Start()
{
rr = Rect(0,0,Screen.width, Screen.height * (1/6.3));
}
function Update()
{
OnMouseOver();
OnMouseExit();
}

function OnMouseOver()
{
if(rr.Contains(Input.mousePosition))
{

Debug.Log(“i am in”);
bool = true;
}
}
function OnMouseExit()
{
if(!rr.Contains(Input.mousePosition))
{
bool = false;
Debug.Log("i am out ");
}
}

and my problem is i was getting the rect position at the bottom of page, but actual output is needed in top of the scene, please help me to solve this problem

thanks in advance…!!

if (rr.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y)))

It may be a vector3 instead of a vector2 - and it may be reversed (input.mousePosition.y - Screen.height) but that should work.

Basically Input.MousePosition starts from the lower-left corner, and the GUI stuff starts from the upper-left corner (or vice versa) so you need to flip the Y.