Question by
Restemayer · Jul 24, 2016 at 03:01 AM ·
androidtouchscreentablet
Android Drag & Drop
I'm implementing a drag and drop system with my program.
Very basic... I'm currently just using the EventSystem drag handler.
public void OnDrag(PointerEventData data)
{
transform.position = data.position;
}
This works great with a mouse. On my android tablet it... works... kinda. It responds, but the movement is very jerky. Is there an alternative implementation specific to Android touchscreen that I should be looking at? Thanks.
Comment
Answer by dmart331 · Apr 09, 2018 at 07:53 PM
Sorry for the late answer but OnMouseDrag() works with a mobile drag as well:
void OnMouseDrag()
{
Vector3 mousePosition = new Vector3(Input.mousePosition.x, Input.mousePosition.y, distance);
Vector3 objPosition = Camera.main.ScreenToWorldPoint(mousePosition);
transform.position = objPosition;
}
no it doesn't work in mobile . when you build the game and try it the function doesn't work out the way you want it