Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: uberwleiss on November 15, 2014, 07:32:18 PM

Title: if(hoveredObject == null) doesn't work, it's UI Root if nothing is clicked
Post by: uberwleiss on November 15, 2014, 07:32:18 PM
Hello,

I've updated NGUI for my older game because of porting it to WP8 (the old version didn't work). I've updated NGUI to the latest version and using the version of Unity 4.6 RC2 Beta.

The problem is that "if(UICamera.hoveredObject == null)" doesn't work. When i debugged, to show which object is actually hovered when I click, it's always UI Root if I don't click any NGUI button.

I've worked around this by changing it to if(UICamera.hoveredObject == uiRoot) and it works now. But I wonder if this is the intended behaviour?

Thanks
Title: Re: if(hoveredObject == null) doesn't work, it's UI Root if nothing is clicked
Post by: uberwleiss on November 16, 2014, 08:03:04 AM
OK, I've done the same with another project. Same problem.

What is the right way to prevent clicks/taps going through the buttons into the game?

Thanks
Title: Re: if(hoveredObject == null) doesn't work, it's UI Root if nothing is clicked
Post by: ArenMook on November 17, 2014, 08:52:34 AM
Change that statement to: if (UICamera.hoveredObject == UICamera.fallThrough)

P.S. Also note that there is UICamera.isOverUI.