- Home /
Inverse the mouse position value
Hello,
I have a GUI button that pops up on the mouse position, only problem is, is that the Y axis is the wrong way round.
If I move my mouse left or right, the button follows the mouse fine, but if I move it up or down, the button moves in the opposite direction. Is there a way to reverse the value?
if(toggleClick == true){
if(GUI.Button(Rect(Input.mousePosition.x, Input.mousePosition.y, 100, 50),"Pick Up")){ //+50
toggleClick = false;
}
Thanks
Comment
Best Answer
Answer by · Feb 22, 2011 at 12:12 AM
You could subtract mousePosition.y from the current Screen.height.
This worked for me. touchPositionY = Screen.height-Input.mousePosition.y;