Search Unity

OnDrop get called if I drag the object quickly but not if I drag it slowly !!!

Discussion in 'UGUI & TextMesh Pro' started by tarek0z, Oct 11, 2019.

  1. tarek0z

    tarek0z

    Joined:
    Oct 4, 2019
    Posts:
    1
    My drop zone code is as simple as :

    Code (CSharp):
    1. public void OnDrop(PointerEventData eventData)
    2. {
    3. Debug.Log("item was dropped");
    4. }

    The object that's being dragged has the following code :

    Code (CSharp):
    1.     public void OnDrag(PointerEventData eventData)
    2.     {
    3.         var mouseScreenPoint = new Vector3(eventData.position.x, eventData.position.y, transform.position.z);
    4.         mouseScreenPoint = Camera.main.ScreenToWorldPoint(mouseScreenPoint);
    5.         transform.position = new Vector3(mouseScreenPoint.x, mouseScreenPoint.y, transform.position.z);
    6.     }
    and it has a Canvas-Group-Component attached with Block raycasts set to false,

    If I drag the object and drop it quickly the code works ! if I drag it a little more before I drop it, it doesn't work !