Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: kromenak on January 13, 2014, 02:08:25 PM

Title: Input on Clipped Content
Post by: kromenak on January 13, 2014, 02:08:25 PM
Perhaps this is by design in the NGUI 3.0, but I wanted to check.  I noticed that when we have a scrolling panel that is clipped, I can still click buttons on the scrolling panel that are outside the clipping area.  This has lead to some confusion and bug reports, since testers tap on an empty area underneath a clipped panel, but it still reacts as though you've just clicked a button that is outside the clipping area.

It's possible to add additional colliders to block input outside of the clipped panel, but that seems like a hack that wasn't required with previous versions of NGUI.  I also noticed that this seems to only happen when the UICamera Event Type is set to "World".  Setting it to "UI" seems to behave correctly, but I haven't tested it thoroughly.

So, should input function this way, or is this a bug?
Title: Re: Input on Clipped Content
Post by: ArenMook on January 13, 2014, 05:33:20 PM
You need to set your UICamera to "UI" mode, not "World". "World" is meant for world events. UI is meant for UI events. Only UI events can be clipped by UI hierarchy (panels).
Title: Re: Input on Clipped Content
Post by: helmesjo on April 07, 2014, 04:00:44 AM
I'm currently running v3.5.6 and got this issue, even with mode set to "UI". Any hints of what I might be doing wrong?

Edit:
Can it be a bug related to nested panels?
Title: Re: Input on Clipped Content
Post by: ArenMook on April 08, 2014, 12:55:39 AM
Most likely, yes. Change UICamera.IsVisible to this:
  1.         static bool IsVisible (ref RaycastHit hit)
  2.         {
  3.                 UIPanel panel = NGUITools.FindInParents<UIPanel>(hit.collider.gameObject);
  4.  
  5.                 while (panel != null)
  6.                 {
  7.                         if (!panel.IsVisible(hit.point)) return false;
  8.                         panel = panel.parentPanel;
  9.                 }
  10.                 return true;
  11.         }
Title: Re: Input on Clipped Content
Post by: helmesjo on April 08, 2014, 05:07:31 AM
Most likely, yes. Change UICamera.IsVisible to this:
  1.         static bool IsVisible (ref RaycastHit hit)
  2.         {
  3.                 UIPanel panel = NGUITools.FindInParents<UIPanel>(hit.collider.gameObject);
  4.  
  5.                 while (panel != null)
  6.                 {
  7.                         if (!panel.IsVisible(hit.point)) return false;
  8.                         panel = panel.parentPanel;
  9.                 }
  10.                 return true;
  11.         }

Had to make the same change for static bool IsVisible (ref DepthEntry de) also, but now it works (guess you meant this too). Don't forget til next update!

Thanks! :)
Title: Re: Input on Clipped Content
Post by: ArenMook on April 09, 2014, 03:57:42 AM
Will do, thanks!