GUITexture and click-through

Hi, I’m having the following issue: I have an interface panel made of GUITextures (1 background texture and others for buttons that users can click).

The problem arises when the user clicks on the GUITexture and behind that texture there is a 3D object with a collider that also accepts clicks: the same click is detected by the object behind the window.

Shouldn’t clicks stop on the frontmost object ?

I went through the forum and it seems a recurring issue with Unity for which nobody still didn’t find any solution; can anyone confirm that or am I missing some programming tricks ?

Thanks in advance !

If you are talking about a 3D object selected from its screen position by a raycast, then there isn’t any particular reason why the GUI elements would prevent the raycast hitting its target and the hit object being reported. When you get the screen position of the mouse click, you could check to see if the click falls inside a GUI element rectangle and ignore it if it does, but proceed with the raycast otherwise.

While I do understand your point of view, I think it would also be reasonable to have frontmost interface items (even if part of GUI things) to intercept and not let pass through mouse clicks; at least this should be a settings that could be enabled or not enabled… This would make things a lot simpler.

I agree that it would probably be helpful if the GUI system worked like that, but I don’t think there is any way to make it happen currently.

Already posted a message in the “wish list” section !