In my scene I have a Perspective camera with a RenderTexture and an Orthographic camera showing a full-screen Plane with the RenderTexture applied to it. For proprietary reasons I can’t really go into detail as to why it must be this way. I can say that I have a GameObject in the ortho view, on top of the Plane, that the user will click-drag with the mouse. The GameObject has a box collider component and a script to handle the dragging behavior.
Now for the weirdness. If the RenderTexture is 1024x1024, my GameObject doesn’t get OnMouseDown() calls. If the RenderTexture is 512x512, OnMouseDown() works fine and I can drag the object. :shock:
So, to make sure nothing else in my scene was causing this, I made a new scene that is as simple as possible but still reproduces the issue (attached).
I’m wondering if anyone else has seen this issue or could test on their machine to verify. I updated to Unity 3.4 today, but was able to reproduce this in 3.3 as well.
649578–23208–$test_rtt_cameras.unitypackage (13.1 KB)
OOOOOkay, came into work today and ran the test scene again. Now I’m getting OnMouseDown() calls for either RenderTexture size. But not for the whole cube! Just for a small part of the cube. If I remove the RenderTexture from the Perspective camera and have the Ortho clear to Depth Only, it’s more apparent as to why.
It looks like it’s the Perspective camera getting the mouse click and not the Ortho camera. The Perspective cube is smaller than the Ortho cube. But I want the Ortho camera to get the OnMouse events! Since I’m not getting any feedback here, I may post followup questions elsewhere.
the main camera is gonna get them I think
if you want explicit control (and if you want to not have problems, which you will have sooner more than later) don’t use OnMouse events but instead do a Raycast with the Camera Ray of the camera you want to use, that way its granted to be the right camera and its granted to precise