Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: mtran003 on May 10, 2012, 09:15:42 PM
-
I have a NGUI label on my game and am trying to make it respond to touch/mouse click events. My function OnClick is not getting triggered. Can someone help? I have the UICamera script attached to my camera that's rendering my GUI layer and I have my custom script which contains the function OnClick attached to my label. I have also attached a box collider to my label and have it sized to cover the entire label text
Nothing is happening.
I am using Javascript.
Thanks. :'(
-
There is an NGUI menu command that adds a collider and resizes it properly for you -- NGUI menu -> Add Collider.
Make sure that the UICamera's event mask matches its visible mask.
-
Yes, I have added the collider using NGUI's menu option and the UICamera mask is the same as the camera and the label I want to receive the touch event.
But nothing is triggering.
-
Do you have "Raycast Hit Triggers" checked in your physics settings?
-
I found the issue.
Through a process of elimination, it turns out that a second UI grouping that I had (for other uses) which also contains a camera with the UICamera script attached was apparently intercepting the events. Since it turned out that the second camera was redundant (probably added via the NGUI wizard and I missed it), I deleted it and now the events are being triggered.
Regards.