I am most probably just to stupid to find the answer on my question, but I didnt manage to find it. I am creating an object with collider which creates another object on OnMouseDown. This other object is created at the same position as the first one and is also meant to react to OnMouseDown. Now my problem is, that OnMouseDown is only triggered if the collider of my object is "visible" under the mouse coursor. As big parts of second objects collider are covered by the collider of the first one, I think that I have to destroy the collider of the first object. I just dindt find a way that worked. And while I am already at it, it would also great if someone could let me know on how to create that destroyed collider again.
I managed destroying the collider, it didnt work before as the code crashed in the line before and actually still does... I just have to call Destroy(collider);
Maybe you are trying to reference the destroyed collider, which causes the crash? In any case, use AddComponent to put the collider back.
Alternately, instead of creating/destroying, put the collider on the IgnoreRaycast layer, which will cause it to be invisible to raycasts (which are used in OnMouseDown).
answered Mar 17 '10 at 08:32 PM