Tag Info

New answers tagged


When you resize your game resolution you need to update every single rectangle in your game (every button, etc) and multiply it by a proper scale, so that the "hitboxes" would work, which would be a lot of work. So, a smarter way of achieving the same result is simply by multiplying your mouse position by a Vector2 scale = new Vector2(originalWidth / width, ...


The mouse is in the screen coordinates. The screen is two dimensional. And you are trying to convert the 2d screen coordinates to 3d world coordinates. You need to specify the desired z position to the mouse position vector (you can think of it as the distance from the camera): var mousePos = Input.mousePosition; mousePos.z = 10f; mousePos = ...

Top 50 recent answers are included