So I was using what I learned in this course to make a grid.
When I click a card it loads a ghost that hovers over gridposition closest to the mouse.
When I click a position with a ghost it instantiates the prefab.
Now I was having a weird bug where despite hovering the correct location on a tile, my mouse was occasionally hovering the next tile over or even diagonally (up and / or right respectively).
In my memory, there was something I remember learning about offsetting the mouseposition by a certain vector to get the true position, this is not in the course so I couldn’t remember where I learned it and can’t find any reference to it online with my limited searching skills.
I subtracted the vector3 (1,1) from my Vector2 GetPosition() results and immediately it fixed the weird mouse issue.
return Camera.main.ScreenToWorldPoint(InputManager.Instance.GetMouseScreenPosition()) - new Vector3(1,1);
The question: Why???