Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: ENAY on July 01, 2012, 11:10:16 PM

Title: UIDrag problem
Post by: ENAY on July 01, 2012, 11:10:16 PM
Simple question really, and struggling to figure out how to do it, but.

I want to drag a card onto a slot.

I have two objects, one I am moving around with UIDrag, All I want to do is drag it so it connects the other object and stay there. Now when I start dragging my object, I can't seem to figure out how to detect that it is hovering over the other one.

Looking in UIDragObject.target. All it finds is the current object that I am clicking on.
And combined with my other issue in another thread. When I am dragging my thumb on the screen, I don't seem to have a way to detect whether a button (or anything) is under my thumb.

I am feeling really stupid not being able to do something which I think should be quite straight forward.
Title: Re: UIDrag problem
Post by: ArenMook on July 01, 2012, 11:12:02 PM
You need to disable the collider of the object you're dragging while it's being dragged.
Title: Re: UIDrag problem
Post by: ENAY on July 01, 2012, 11:26:00 PM
That was going to be my next question. How do I check if an object is being dragged directly?
There doesn't seem to be anything in UIDragObject to check whether it is on the move.

ie

if (obj].GetComponentInChildren<UIDragObject>().isSelected == true)
{
}

If I check for

.enabled
.active

They are both always true.

[edit]

Ok, in the end I have simply decided to just use onDrag, detect for button presses and releases and then do the collision code separately.
Title: Re: UIDrag problem
Post by: ArenMook on July 02, 2012, 01:02:34 AM
OnPress(true) starts the drag. OnPress(false) ends it. OnDrag() is sent in-between.