Search Unity

UI Drag and Drop System

Discussion in 'Unity UI (uGUI) & TextMesh Pro' started by Robotsan, Oct 21, 2016.

  1. Robotsan

    Robotsan

    Joined:
    Feb 3, 2015
    Posts:
    3
    Hi , I am trying to develop basic programming interface for children, as a beginner at Unity Engine I can't understand complicated scripts. Even I watched almost all tutorials about drag and drop process still I don't know how to implement it to my project .

    I tried to use this asset : https://www.assetstore.unity3d.com/en/#!/content/66449 but its script is reallt complicated for me and I couldn't edit this script as I intented.

    My example panel below here;

    UI_design_question.PNG

    I need to achive few things ;

    - Drag a object from upper panel and drop it to lower panel
    - Learn which lower panel has which objects. For exp; First lower panel has up button and second lower button has right button and so on.

    How can I simply do this? Where do I start?

    Thank you.
     
  2. TheValar

    TheValar

    Joined:
    Nov 12, 2012
    Posts:
    754
    gregdetre, Vatio, Belleal and 2 others like this.
  3. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,630
  4. Robotsan

    Robotsan

    Joined:
    Feb 3, 2015
    Posts:
    3
    Did you use Xander's Example ? His prefabs are not working or I couldn't understand them. Also when I try to open his example scene Unity crashes.
     
  5. TheValar

    TheValar

    Joined:
    Nov 12, 2012
    Posts:
    754
    just tested it and it didn't work for me either. Could be that he's using a beta version of Unity or something idk. Recommend you go to the video I posted or check out the project that @SimonDarksideJ provided (it's a great package and I use it as a starting point for a ton of stuff)

    Edit: I'm talking about the UI Extensions Project here, not the asset store package in the link. My bad :D
     
    Last edited: Oct 24, 2016
    SimonDarksideJ likes this.
  6. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,630
    Also for pointing out great projects, check my sig.
    Also check out the community driven UI Extensions project, crammed full of new UI controls and source

    It's a vast array of UI stuff with more being added each build.
     
  7. walidabazo

    walidabazo

    Joined:
    Jul 8, 2017
    Posts:
    16
    Very good tutorial to how drag and drop and matching object

     
  8. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    1,981
    Thanks for necro-ing a +1 year old thread for a 3 min video.
     
  9. ZoidbergForPresident

    ZoidbergForPresident

    Joined:
    Dec 15, 2015
    Posts:
    80
    Thanks for posting a more recent video! :)
     
  10. Hashirali890

    Hashirali890

    Joined:
    Mar 18, 2018
    Posts:
    1
    what if we save it for next time what we should then what method should we use
     
  11. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,437
    Afaik the videos are still valid. They're based on the interfaces (which i don't think have changed):

    IBeginDragHandler, IDragHandler, IEndDragHandler and perhaps IDropHandler

    I think a lot of beginners assume that UI will include all of the general functionality that they're used to in the basic OS experience - which is unfortunately presumptuous and incorrect. The UI system and most Unity systems are not going to assume what functionality your game includes and bloat things unnecessarily other than very basic ui components and events so in the case of 'drag-n-drop' type things they simply offer interfaces for callbacks that you can use on UI components to implement this functionality on your own. You'll decide what happens when you get these callbacks and manage the dragged components yourself.

    Notice that PointerEventData is passed as an argument for these callbacks and contains all of the information you need to be able to implement the functionality you need. It's simply up to you to take care of actually implementing it. The tutorials offer several ways to do this, so it's not a big mystery or magic; it's just basic development.

    It is a pretty old necro-esque thread, but the topic and information seems to all still be relevant.
     
  12. barskey

    barskey

    Joined:
    Nov 19, 2017
    Posts:
    207
    Maybe I missed something, but I don't think this is a very good tutorial at all. In three minutes, they basically drag two pre-made gifs to the project, and create two Images using then. Then they drag three pre-made scripts to import them, and attach them to some game objects. And finally point at some lines in the code with the mouse.

    I am pretty sure there are many other more informative tutorials out there. Just my two cents.
     
    zakash and Sanctus2099 like this.