using System.Collections.Generic; using uiwidgets; using Unity.UIWidgets.Editor; using Unity.UIWidgets.gestures; using Unity.UIWidgets.widgets; using UnityEditor; using UnityEngine; namespace UIWidgetsEditorWindowSample { public class UnityObjectDraggingWindow : UIWidgetsEditorPanel { [MenuItem("UIWidgets/EditorSample/UnityObjectDragging")] public static void CountDemo() { CreateWindow(); } protected override void onEnable() { AddFont("Material Icons", new List {"MaterialIcons-Regular.ttf"}, new List {0}); AddFont("CupertinoIcons", new List {"CupertinoIcons.ttf"}, new List {0}); AddFont("GalleryIcons", new List {"gallery/GalleryIcons.ttf"}, new List {0}); } protected override void main() { editor_ui_.runEditorApp(new MyApp()); } public class MyApp : StatelessWidget { public override Widget build(BuildContext context) { return new Container(color: Colors.green, child: new Center(child: new UnityObjectDetector( child: new Container(color: Colors.blue, width: 200f, height: 200f, child: new Center(child: new Text("Drag UnityObject or file to me"))), onEnter: (details) => { Debug.Log("enter"); }, onHover: (details => { Debug.Log("position = " + details.position); }), onExit: () => { Debug.Log("on exit"); }, onRelease: (details) => { Debug.Log("on release"); } ) ) ); } } } }