I’m using an OnMouseDown event, which I have experience with. Unfortunately, the hit box is much smaller than the game object (its visible texture, anyway). In other words, say my gameobject is 5 x 5 x 5, my hit box I can imagine would be something like 0.1 x 0.1 x 0.1.
It is unclickable at normal size (I can’t find the tiny hit box). I have to stretch the texture until it is taking up much more space than the screen area.
Shouldn’t the size of the hit box be 1 to 1 with the size of the gameobject (visible texture)? That’s how it works in other instances in my game. Any idea what the issue could be?
OnMouseDown is an abstraction of raycasting from the mouse position. Therefore - whether the method fires is dependent on the size of the object’s collider(s) which may or may not be the same size as the object in the world.
I’ve tried manipulating the size of the collider (I’m using a box collider), but the click does not seem to register when I click it.
I have an idea of what the problem is, but I’m having problems fixing it.
I’m fairly certain something invisible is blocking the click. I pulled the game object way out on the z-axis, towards the camera (from ~0 to -29.7). Eventually, it was clickable. Anybody ever run into this before? Is there way to check for the click through whatever else is in between the game object and the camera, or any way to identify what could be in between? I really can’t imagine what I have in the way that is that far out on the z.
there is the RayCastAll function…
might help find whats in the way.
Thanks Lefty. I actually managed to figure this out on my own, but didn’t have time to post up in here. Unfortunately, I had to go through every one of my game objects. Eventually, I found one that had the renderer disabled, but the collider enabled. Problem solved!
However, I’m sure that function will come in handy in the future!