Is there a way to ignore OnMouseDown() if a collider is set to Trigger mode?

Hey there, so I’m making a tower defence game and using a circle collider set to “is trigger” to detect which enemies are in the range of a certain tower, but because of that if I click anywhere in the range of the tower it calls OnMouseDown(), I would like it to only be called when the mouse is over the sprite instead.

Is there a way to ignore that specific collider when clicking? The only other work around I can think of is to rewrite the detection system using the OverlapSphere function.

Thanks so much for your time!


To have better control of what players click on, is recommended to use Raycasting . This way you can detect all colliders in a straight line from the mouseclick, and then using if sentences can specify what to click.

I recommend you to watch this 2 tutorials: