- Home /
Detect OnMouseUp on gameobject with different colliders
Hi, i have build in different boxcolliders in my scene to detect where my orbitcamera is moving and reacts on it with different lightsetups. This works great.
But now ive created an sphere and i want to click on that object. On that sphere ive added a simple script to test it:
void OnMouseUp()
{
print(gameObject.name);
}
While running the sphere-message doesnt appear because the different box collider (for the camera) is overlaying my sphere. Is there any way to get both things working? However can i click on my object and check whether ive clicked on my sphere-collider?
Thanks for your time and any hints..
Edit: Ive tested to give the box collider for my camera script an extra layer and my sphere an extra layer. I thought this would help, but unfortunately not..
Answer by Eric5h5 · Apr 22, 2010 at 07:18 PM
Put the box collider for the camera on the IgnoreRaycast layer.
Thx for your reply. Ive set the parent object with these 5 colliders on "ignore raycast"-layer, but though i cant click on my sphere object.... Any ideas?
@yosh: Set all the objects to the IgnoreRaycast layer, not just the parent.