OnMouseDown() not called on child object collider

I have 27 sub-cubes arranged into a larger cube. I have a box collider for each sub-cube so I can get the OnMouseDown() call in a script for each to change the cube color. But I also have a script to spin the larger cube and added a box collider for it as well, which surrounds all the other colliders of course.

So now it seems I can spin the large cube, but no longer can access the OnMouseDown() functions in the sub-cubes. I tried using a RayCastAll to "penetrate" the large outer box collider to "select" a subcube, but don't get any hits.

What's the right method to do this? It must be possible... THX.

I was experiencing the same problem, if you have a RigidBody attached to the parent then you may be experiencing this:

By design, compound colliders act as a single collider when you add a rigidbody to the parent, and therefore only the root object will react to OnMouseEnter.

Taken from Eric5h5's comment in: http://answers.unity3d.com/questions/32078/onmouseexit-fires-every-frame-when-the-mouse-is-down

Hope this helps.

You should definitely get some hits with RaycastAll.

Keep in mind that your hits will be in an array. You have to loop through the array and do stuff to your sub-cubes. Do your sub-cubes and large cube have different tags? Maybe change their color depending on their tag when you have them as a result of your RaycastAll. In principle, the RaycastAll should work.