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.

Does OS-Native Drag And Drop work in Unity 2020?

Discussion in 'UI Toolkit' started by chilton, Oct 16, 2020.

  1. chilton

    chilton

    Joined:
    May 6, 2008
    Posts:
    505
    Hi,

    Easy question.

    I want to be able to accept files if the user drags them onto my game's window, at runtime. Is there a way to do that in 2020?

    Thank you,
    -Chilton
     
  2. SimonDufour

    SimonDufour

    Unity Technologies

    Joined:
    Jun 30, 2020
    Posts:
    465
    The drag and drop behaviors are platform dependent and there is no implementation of this in UItoolkit.

    You will have to do the detection of the drag and drop implementation for your target platform first and then change the Ui based on the drag events.

    One such example of managing the native part: https://github.com/Bunny83/UnityWindowsFileDrag-Drop

    I hope this will get you started.
     
    chilton likes this.
  3. chilton

    chilton

    Joined:
    May 6, 2008
    Posts:
    505
    Thank you, that is perfect! All I needed was a foot in the door :)

    -Chilton
     
    SimonDufour likes this.