OnMouseUp not working with two cameras

Hi,

Setting the scene for you, I have two camera’s and two cubes and a trigger. Both camera’s can see their respected cubes but only 1 camera is active at a time and 1 cube is active at a time. When you step in trigger and press enter it swaps camera, disables the active cube and enables the other cube each camera can see that camera’s respective cube.

The cubes have a simple script on them that detects if it is being clicked with onMouseUp.

void OnMouseUp()
{
     Debug.log("You clicked on this");
  }

The first camera clicking on the cube fires the debug log, no problem.
When you change to the other camera through the trigger and you see the second cube with the exact same set up it no longer fires the OnMouseUp.

I dont know what to look for anymore. Can somebody help solve this.

Okay, after essentially re-creating my entire scene I have found the problem.

The camera’s have a rigid body component attached to it. All the ray cast of the mouse up background code was looking at the rigid body and nothing else.

The first camera doesn’t have a rigid body because of different dynamics in the game. So if you are having a similar issue check to see if your camera is housed through the hierarchy inside of a rigid body. it messes things up.