Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: BrightBit on February 26, 2014, 10:21:27 AM
-
Hello again,
I've got a GameObject "Backpack" with two children "Label" (with UILabel, UIDragObject [target is "Backpack"] and BoxCollider) and "Slots" (with a BoxCollider that is even overlapping the Collider of "Label").
My problem is that I can't drag the "Backpack" via "Label" as long as there are children in "Slots". I made a video to illustrate that:
https://www.youtube.com/watch?v=gMqMBkNBWRg
Any idea on why this happens?
Greetings
BrightBit
Note: There's an additional component attached to the GameObject "Slots" but it has no impact on this problem. I already tested that by removing this additional component.
-
Check to see what's interfering with events by enabling Debug on the UICamera and hovering the mouse over the non-responsive object.
-
Okay, I've done so but it didn't help me. Here's a video of it:
https://www.youtube.com/watch?v=tUNnAH_oAEc
-
It's hard to see in that video but what's the size of the collider? For whatever reason, the Raycast is hitting the item's collider. Is it that big?
-
There are just 2 colliders in the gui. The items don't have collider components:
(http://s7.directupload.net/images/140301/de782qcw.png)
-
Yeah that would be why. NGUI's raycasts go by widget depth. However if you don't actually have a widget, it uses the combined widget depth -- that of all the children.
You need to use an actual widget, not just put a collider on an empty game object.
ALT+SHIFT+W, ALT+SHIFT+C, resize this widget. This is the collider you should be using -- for both the title bar and the item container.
-
Okay, you were right. That was the problem. Thank you. :)