Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: storm33229 on May 29, 2013, 07:56:32 PM

Title: How do I check if mouse is over UI?
Post by: storm33229 on May 29, 2013, 07:56:32 PM
How do I determine that the mouse is over the UI? I don't want clicks to process in the game if I am busy clicking on the UI (even if the UI I click isn't responding to clicks, or doesn't have a collider).
Title: Re: How do I check if mouse is over UI?
Post by: ArenMook on May 30, 2013, 12:29:14 AM
UICamera.hoveredObject != null.

NGUI events works with colliders, not widgets. If there is no collider then the widget will not receive any events, and hoveredObject will not be updated.
Title: Re: How do I check if mouse is over UI?
Post by: storm33229 on May 30, 2013, 08:36:46 AM
UICamera.hoveredObject != null.

NGUI events works with colliders, not widgets. If there is no collider then the widget will not receive any events, and hoveredObject will not be updated.

That works. I just had to write a script to auto-attach (and correctly size) a collider to a widget on Start(). It does this for all widgets. I do not have a very intense UI though.