Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: singh029 on December 14, 2015, 11:46:07 PM
-
is there an ngui way to detect when user touches outside of the panel when the panel is open.
an open panel is visible on the screen. a closed panel slides off of the screen.
I was trying to use this method
http://answers.unity3d.com/questions/947856/how-to-detect-click-outside-ui-panel.html (http://answers.unity3d.com/questions/947856/how-to-detect-click-outside-ui-panel.html)
but ngui panel and rect transform dont play well together.
Currently i just have a box collider that slides in with the panel.
There has to be a better method!
-
Panel, in NGUI's terms, is just a script that draws widgets. Panel has no "rect".
Now if you create an invisible widget (ALT+SHIFT+W), then it will have a rect and you can place a collider on it (ALT+SHIFT+C), thus allowing it to receive touch events.
If you want to check if your touch is within the UI, easiest thing to do is to check UICamera.isOverUI -- this will work with NGUI's events, such as OnDrag, OnHover, OnClick, etc.