- Home /
Question by
amokk_gw · May 05, 2016 at 03:54 PM ·
draguser interfacedrag-and-drop
OnDrag - Object lagging behind the mouse cursor.
I'm using a IDragHandler to take care of my object drag & drop. However the object is always lagging a bit behind the mouse cursor. I first thought it's an editor issue, but it happens as well in a standalone build. Anyone knows how to fix this?
public void OnDrag(PointerEventData eventData)
{
Vector2 localPointerPosition;
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(this.transform.parent.GetComponent<RectTransform>(), Input.mousePosition, eventData.pressEventCamera, out localPointerPosition))
this.transform.localPosition = localPointerPosition - offset;
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612080224im_/https://answers.unity.com/themes/thub/images/avi.jpg)