Unity-Technologies / com.unity.uiwidgets

UIWidgets is a Unity Package which helps developers to create, debug and deploy efficient, cross-platform Apps.
https://unity.cn/uiwidgets
626 stars 78 forks source link

Add support to Editor Drag&Drop #268

Closed zhuxingwei closed 2 years ago

zhuxingwei commented 2 years ago

This PR aims to add Drag&Drop support for UIWigetsEditorWindow, which enables features like: (1) user can drag a Unity GameObject into a UIWigetsEditorWindow and drop it inside this window; (2) user can drag any file from the OS (e.g., FileOpenDialog or Finder (on Mac)) into a UIWigetsEditorWindow and drop it inside this window;

This PR also modifies UIWidgets libraries.

How to Use: (1) You need to use UIWidgetsEditorBinding to create the App in the main method of your UIWidgetsEditorPanel like:

protected override void main()
{
      editor_ui_.runEditorApp(new YourApp());
}

(2) The functionality is wrapped inside a widget: UnityObjectDetector, in which there are four callbacks that can be triggered when: (A) dragging UnityObject or file to enter the widget; (B) dragging UnityObject or file to exit the widget; (C) dragging UnityObject or file and release it inside the widget; (D) dragging UnityObject or file and moving inside the widget

How to Test: You can find a test sample in the Editor main menu under UIWidgets/EditorSample/UnityObjectDragging

guanghuispark commented 2 years ago

Now that we have made this change, do we need to update the dll file?

zhuxingwei commented 2 years ago

Now that we have made this change, do we need to update the dll file?

yes we do. I have updated the Mac library (Debug version) so that you can test the functionality on your Mac. I will update other libraries once this PR is approved

zhuxingwei commented 2 years ago

Now that we have made this change, do we need to update the dll file?

yes we do. I have updated the Mac library (Debug version) so that you can test the functionality on your Mac. I will update other libraries once this PR is approved

all libraries are updated and tested