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?