objRect.y = Mathf.Abs(MousePos.y - Camera.main.pixelHeight);
Is there a Java equivalent to C#'s Mathf.Abs?
Thank you.
EDIT: This is my complete script, I have another problem!
var ShowRollover;
var objRect : Rect;
var mousePos : Vector2;
var offset : Vector3;
offset = new Vector3(16, 16, 0);
function Update()
{
ShowRollover = false;
objRect = new Rect(0, 0, 500, 100);
mousePos = new Vector2(0, 0);
}
function OnMouseOver()
{
ShowRollover = true;
}
function OnMouseExit()
{
ShowRollover = false;
}
function OnGUI()
{
if (ShowRollover)
{
mousePos = Input.mousePosition + offset;
objRect.x = mousePos.x;
GUI.contentColor = Color.yellow;
objRect.y = Mathf.Abs(mousePos.y - Camera.main.pixelHeight);
GUI.Label(objRect, "Name: Common Carp
Number of fish in patch: 8");
}
}
I found that if the label cannot be seen even when I'm hovering the mouse over the object with the collider. Is there any mistake that I made?