mouse.Position.y mirrored?

I’m trying to make a GUI group with explanations for different things follow my mouse. As GUI elements’ position is represented by Rect I can’t just use Input.mousePosition, because this returns Vector3, so I just split it:

if(GUI.tooltip){
	GUI.BeginGroup(RectInput.mousePosition.x, Input.mousePosition.y, 150, 100));
    GUI.Box (Rect (0, 0,150,100), "");
	GUI.Label (Rect (5, 5, 140, 90), GUI.tooltip);
	GUI.EndGroup();
	
	}

Now, the group follows the mouse cursor on the X normaly, but the Y direction is somehow mirrored, so instead of the box being attatched to the mouse it’s Y position gets mirrored with the one of the mouse. I tried -Input.mousePosition.y, but that made the box disappear. Since I couldn’t find a single topic for this in the forums or in UnityAnswers I guess this is something common, but that’s the only way to track the mouse position on the screen, right?

I don’t know if there is a specific reason for it, but its just something that I’ve always noticed. The UI considers the top left corner of the screen the (0, 0) point while the mouse position looks at the bottom left. Change your code this way and it should work the way you want it.

if(GUI.tooltip){
	GUI.BeginGroup(RectInput.mousePosition.x, Screen.height - Input.mousePosition.y, 150, 100));
    GUI.Box (Rect (0, 0,150,100), "");
	GUI.Label (Rect (5, 5, 140, 90), GUI.tooltip);
	GUI.EndGroup();
	
	}

the screen.height - y mouse position adjusts it accordingly to match the UI

Thanks! Now it works. It’s a little bit slow though, but it’s OK ( a little effect :smile: )