How do I click on an object behind another mesh collider?

I’m new to unity and have run in to a design issue I don’t know how to solve.

I have an object that has buttons on it and everything works fine.

Now I want to be able to right click on the object and have it zoom towards the camera.

The mesh collider that would surround the entire object blocks my ability to use the buttons now.

Is there a way I can detect the buttons through the mesh collider that is surrounding it or is there a better method?

Thank you.

One way you can solve this is by using Raycast and setting a layer mask. So the ray will ignore your first collider, and will hit the one behind.

It means you can’t use OnMouseDown any more but that’s the price you pay when you start making more complex games :slight_smile: