Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: kennethljj on February 13, 2014, 04:42:56 AM
-
Hi All,
I have 3 instances of a cube next to each other, each contains the same script and a colldier, basically a clone of a prefab. (eg. cube A, B and C)
I would like to start dragging at cube A, drag pass cube B and over to cube C. (The cubes does not move, I just need the mouse/touch collider event)
When dragging over cube B, I would like to flag a boolean for the scipt attached to cube B and do the same when I drag over cube C as well. Let's say "isCollided = true;"
I have managed to use OnDrag to capture the start of the dragging event but was unable to capture the collision of the rest of the cubes.
Sorry for the poor english and explanation. Hope someone can help.
Thanks in advance.
-
You're missing OnDragOver and OnDragOut.
-
You're missing OnDragOver and OnDragOut.
Hi Aren, thanks for the reply.
I did a Debug.Log for both OnDragOver and OnDragOut but it didn't work as expected.
The debug message was not printed when i drag across the objects in and out of the colliders.
-
The notification is sent to what you drag over, not what you're dragging, and is only sent if there is nothing else blocking the event. This is why disabling the dragged object's collider is important.
-
The notification is sent to what you drag over, not what you're dragging, and is only sent if there is nothing else blocking the event. This is why disabling the dragged object's collider is important.
Hi Aren, Thanks again for the reply. I am not dragging any object across the screen. I just simply want to detect mouse drag over/ touch drag over.
I have 3 objects will colliders and the same script which contains OnDragOver and etc. If any of those events occur, I issue a Debug.Log print message. However, when I start dragging from 1 object to another, I do not receive the 2nd or 3rd objects' events. Like you mentioned, do I need to disable the 1st object's collider to make this work?
-
If you are not actually moving the collider you pressed on, then you don't need to disable it. Make sure your NGUI is up to date by the way.
-
Ok, will figure it out. Thanks a lot.