Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: favoyang on June 25, 2014, 05:44:03 AM

Title: Weird Clipping Panel.IsVisible(Vector3) result
Post by: favoyang on June 25, 2014, 05:44:03 AM
  1. UI Root           # panel.depth = 0
  2.   Camera
  3.     Panel         # height = 800
  4.       Bg Collider # a full screen collider
  5.       Clip Panel  # panel.depth = 1, size 300x300
  6.         Button
  7.  

In a simple 2d UI setup as above, I put a full screen "Bg Collider" at the bottom and a small "Clip Panel" with a "Button" inside on the top. Kind like a trivial modal dialog. If I click the button, it will response me. If I click the rest part of the screen, the "Bg Collider" will capture the event to avoid it pass to any widgets behind the panel. Now the tricky thing is that if I changed transform.localPosition.y of "Clip Panel" to any number bigger than 150, say 160, the button will no longer receive the event.

Digging into NGUI source code, I found that in UICamera.Raycast(Vector3 inPos), mHits will be [Button,Bg Collider], but later IsVisible(lastWorldPosition, Button)) return false. But it shouldn't.

If change the "Clip Panel" to no clipping, then it works again.

Is this a bug? or I shouldn't move a clipping panel by change it's transform?

Please check out the test project at https://bitbucket.org/favoyang/2dhitordertest (you need import NGUI 3.6.5)
Title: Re: Weird Clipping Panel.IsVisible(Vector3) result
Post by: ArenMook on June 25, 2014, 07:44:26 AM
Can you please attach a unitypackage here or a zip file instead of using bitbucket?
Title: Re: Weird Clipping Panel.IsVisible(Vector3) result
Post by: favoyang on June 25, 2014, 12:48:18 PM
Sure, see the zip in attachment.
Title: Re: Weird Clipping Panel.IsVisible(Vector3) result
Post by: ArenMook on June 26, 2014, 10:07:20 AM
Thank you, I found the issue and fixed it. You can grab it from the repository if you have Pro access. Otherwise you will find it in Friday's update.
Title: Re: Weird Clipping Panel.IsVisible(Vector3) result
Post by: favoyang on June 26, 2014, 01:30:55 PM
Great, will double check after receiving the Friday update. Thanks!
Title: Re: Weird Clipping Panel.IsVisible(Vector3) result
Post by: favoyang on June 29, 2014, 01:04:46 AM
Yes, fixed.