Ok, I’ve been trying to figure out how to not deselect the buildings in my RTS project when left clicking. The way I’ve coded it, the only way I can think of to do it is to check to see if the mouse is over a GUI element or not, and if so, don’t do the left click event (which deselects every thing).
So, simple question, Can you tell if the mouse is over a GUI element (drawn by code), and if so, how?
**Note, I have been looking for a few hours now and haven’t seen anything.
in the GUI element add a script that sends out a message on mouse enter, and one that tells when mouse exits. For the object you’re NOT trying to pick (the things beneath the GUI that reacts to mouse events – ie. buildings) receive GUI Mouse Enter Exit messages and turn off its input while gui is active turns off when no longer hovered over.
At least this is how I did it. But it may not be appropriate to your game (since I don’t use to may cpu for other things and depending on how many things you turn off this could drastically hurt performance). Hope it helps.
instead of sending messages to all game objects you could simply use a public variable to determine if the mouse is over a GUI element but there might be situations where you will want to send out message anyways so it’s up to you to decide which way you want to do it
At this point all of my GUI elements are made in the “buildings” and “units” scripts, so I can’t just do a on mouse enter/leave event, unless there is a way to tell that way, or I guess I’d have to use the actual GUI objects.
At the very least, I could make a static array of rectangles I suppose, but that’d be a lot of effort. XD Maybe make a create gui elements script to auto add and remove stuff from the array.
there’s a pretty good example using tooltips in the documentation, which might be what you are looking for
THANK YOU!!!
That last section is what I need I think. I’ll try it out when I get off work.
do any of you no the mouse look script if u do plz tell me 
Do you mean the one supplied with Unity? Just select it from the menu: Components > Camera-Control > Mouse Look. If that’s not what you mean then please start a new thread - you should get a better response that way.