Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Hold to drag an item from scrollable panel

Discussion in 'UGUI & TextMesh Pro' started by RifS, Aug 28, 2015.

  1. RifS

    RifS

    Joined:
    Nov 27, 2013
    Posts:
    33
    I have been having trouble implementing this.

    The problem is :
    I have a collection of UI items ,stored in scrollable panel "A", that can be dragged into some certain slots on other panel "B".
    The procedure to drag out an item from the panel A is to hold on item, wait for about 0.5 seconds, then the item will be popped up for dragging. If the user successfully to release it on the slot in panel B. then the item is successfully placed, otherwise, it should be bounced back to the list of item in panel A.
    Basically, it's a similar procedure to placing an app from your app launcher into your your Android home screen.

    This problem would be easy if the panel is not (vertically) scrollable, but the challenge is the user need to be able to scroll panel A like normally one scrolling through a long document.
    So I cannot use IBeginDragHandler, IDragHandler, and IEndDragHandler, because these will make the item being dragged blocks the raycast and the panel unable to know it's a scroll gesture.

    In the end, I had to dig deeper on the EventSystems and stucked on the problem of getting a proper PointerEventData inside the Update() function.
    I caught with similar problem by the other user like this one, but I somehow unable to use their StandaloneInputModuleCustom (It's not a monobehavior, so unity report the script is missing when I tried to run my scene.)
     
    Last edited: Aug 30, 2015
  2. RifS

    RifS

    Joined:
    Nov 27, 2013
    Posts:
    33
    Bump.
    Any pointer on how to tackle this problem?