Hello!
I’m having some difficulty detecting clicks on a gameobject. Nothing happens when I click on the object, but after some experimenting, I found that the click is detected on other parts of the screen. These areas appear to change depending on where on the scene the camera is directed. The game is 2d, top-down, and the camera can scroll along x/z axes.
There is a GUI matrix on the scene, not sure if that might be linked to the problem.
Here’s the code I’m using to detect clicks.
void OnMouseDown()
{
Debug.Log("Pre-Scene check click detected " + Input.mousePosition);
// Check if the Scene is 1
if(sceneName == "1")
{
Debug.Log("Click detected");
}
}
Any help would be greatly appreciated. Let me know if you need any more info to solve this mystery!
Update 1
Added mouse position and Camera.main.ScreenToWorldPoint(mousePosition) to the debug. The y value of the ScreenToWorld is 65.8, whereas the turret is around 0.3. Could this have something to do with it? Image of debug below.
