Hi friends…
This is a strange problem with OnMouse functions and Rigidbody…
there is no word to explain it easiest way than looking it with your own eyes…
http://www.mediafire.com/?crc4s9wj66mky2c
The sample project is 1.07 MB - Zip compressed…
If you have time… please look into it…
Thanks…
For people non willing to download, the case is :
- Three gameObject, a cube, a camera, a sphere.
- The camera is the parent of the sphere.
- The sphere is in front of the camera and visible.
- The sphere has a sphere collider and a script with function OnMouseUp, which executes Debug.Log. It help knowing whether OnMouseUp is successfully executed or not.
It works. But when you put the camera as a child of the cube, it do not work anymore, OnMouseUp is not called.
The cube has a rigidbody and a box collider.
My conclusion : I don’t know. The rigidbody seems to be the element causing this…
Hi akila, thanks for explaining the problem… yes… strangely there is a kind of bug with rigidbody and mouse functions… … at least i’m not the only one with this problem…
It seems to work when the script with Debug.Log is on the main parent, not a child…