Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Kichang Kim on August 25, 2012, 08:57:11 PM
-
Hi, I'm working to develop mobile RTS game.
I'm using NGUI for main GUI system (build button, upgrade button, and so on). Additionally, I used Input.touch for picking building or units (using raycasting).
In this case, what is best way to get Rect of NGUI component (label, button, background ...) for ignore picking event on GUI component? I think that checking rect of gui component may be solution. Is there another way to check whether touch point is on gui component?
-
It's generally better if you let NGUI take care of touch detection. It can be used both on your UI camera and your game camera. You can also use it only on the UI camera, but set a UICamera.genericEventHandler -- and it will receive a copy of all the events if you want to handle them from your own manager.
UICamera.lastHit tells you the result of the last raycast, so UICamera.lastHit.collider can be checked -- is it on the UI layer? If so, then the UI is handling the event. If not, then it's an event for your game.
-
Thanks for reply. It looks better using NGUI's inernal touch event system than my own touch system except multiple touch recognition. Can NGUI touch event handle multiple touch and touch phase? (for determine short/long touch, multiple touch for zoom in/out)
-
UICamera.currentTouchID tells you the ID of the touch, so you can do what you want.
-
UICamera.currentTouchID tells you the ID of the touch, so you can do what you want.
Great. I'll try to merge my own touch manager to NGUI. Thanks for quick reply :)