Hi,
It seems that setting UIDragObject's target at runtime doesn't work properly. Strangely, if it is never allowed to be null, and never disabled/enabled, everything's fine.
In the following example, I'm trying to start dragging a transform after a long press on another. The hacky workaround I'm using involves setting up a decoy transform, hmm...
Surely I'm missing something? Setting the target in OnPress(true) works fine too, problems arise when press and setting the target are seperate.
Many thanks for your help,
Gregzo
public Transform targetTransform; // not the receiving collider's transform
public Transform decoyTransform; // assign an empty go in the inspector
UIDragObject uiDragObject;
void Awake ()
{
uiDragObject
= gameObject
.AddComponent ( typeof ( UIDragObject
) ) as UIDragObject
; //uiDragObject.target = decoyTransform; //Uncomment this line, and it works fine.
}
void OnLongPress () // custom long press
{
uiDragObject.target = targetTransform;
}