So, I’m trying to set up some code where the user can click on the screen, and if the position where they clicked corresponds to the coordinates of a game object, that game object does something. I thought I could just use Input.mousePosition to do this, but it turns out that the mousePosition value is not representative of a value in the coordinate plane. Instead, the value represents a position in “pixel coordinates,” which means that, for instance, if I double the size of the game window, then clicking on the middle of the screen produces coordinates twice as large as the coordinates produced from a half-size game window.
How can I get a mouse position input that maps to the coordinate plane, or alternatively, what operation can I perform on the mousePosition variable to obtain a value in the coordinate plane?