If not over interface

Hi, I’ve just made a camera script in which you can drag the camera along the ground. I’ve also implemented a horizontal slider which zooms along the Y axis of the camera.

This all works perfectly, but I had a small question.
How could I prevent the dragging if the mouse is over an interface element?

Thanks in advance!

var isHover : GUIStyle;

function Start()
Time.timeScale == 1;
function Update()
    Time.timeScale == 0;


That should work, although you may need to play around with the .onHover area, because I haven’t used that before, so I’m not sure if it’s bugproof.

If all your GUI stuff are in only one script, then check if the mouse is hover one of the rect with Rect.Contains. Make sure to do this in Update and to group the rects as much as possible.

If they are splitted into several scripts, it’s a bit trickier. I suggest you make all those script give their rects to a master script which will do the testing.