ソースコード
using UnityEditor; using UnityEngine; public class Example : EditorWindow { [MenuItem( "Window/Example" )] private static void Open() { GetWindow<Example>(); } private void OnGUI() { if ( Event.current.type != EventType.MouseDrag ) return; var prefab = AssetDatabase.LoadAssetAtPath<GameObject>( "Assets/Cube.prefab" ); DragAndDrop.PrepareStartDrag(); DragAndDrop.objectReferences = new Object[] { prefab }; DragAndDrop.StartDrag( "Dragging" ); Event.current.Use(); } }