Hi, I’m trying to get the mouse position so I can see if a rect on gui contains it… I am using Vector2 mousePosition = new Vector2(Input.mousePosition.x, Input.mousePosition.y)
. But this is acting like it doesn’t work at all. I tried debugging the Vector2, and seems like y axis is opposite? Tried -Input.mousePosition.y and doesn’t work either. Any help is appreciated greaty
You are close.
mousePosition = new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y);
Not sure why you have to take the screen height then subtract mousePosition Y, kinda bass akwards lol, but this should do the trick.
+1 as a welcome to the community, and for explaining your issue thoroughly.