Hello, I read that you disable 'drag and drop' in the editor because of bugs and stuffs.
But to test out, it is not practical at all.
So I look for a way to drag and drop in the UnityEditor doc to propose alternative code when I am in the editor.
Code is a quick and dirty fix to make test. But you, someone that want to use your tool and reading this, can do it like this:
usingSystem.Collections.Generic;usingUnityEngine;usingSystem.Linq;usingB83Win32;usingUnityEngine.Events;
#if UNITY_EDITOR_WINusingUnityEditor;
#endif
publicclassFileDragAndDrop:MonoBehaviour{publicUnityEventm_onDropDetected;publicstring[]m_filesDropped;privatestring[]m_currentPathsHold;publicvoidUpdate(){
#if UNITY_EDITOR_WINstring[]paths=DragAndDrop.paths;if(paths!=null&&m_currentPathsHold!=null&&paths.Length==0&&m_currentPathsHold.Length>0){m_filesDropped=m_currentPathsHold;m_onDropDetected.Invoke();}m_currentPathsHold=paths;
#endif
}voidAwake(){UnityDragAndDropHook.InstallHook();UnityDragAndDropHook.OnDroppedFiles+=OnFiles;}voidOnDestroy(){UnityDragAndDropHook.UninstallHook();}voidOnFiles(List<string>aFiles,POINTaPos){m_filesDropped=aFiles.ToArray();m_onDropDetected.Invoke();}}In hope to help.
(PS: Thanks for you code, it is very useful)
Hello, I read that you disable 'drag and drop' in the editor because of bugs and stuffs.
But to test out, it is not practical at all.
So I look for a way to drag and drop in the UnityEditor doc to propose alternative code when I am in the editor.
Code is a quick and dirty fix to make test. But you, someone that want to use your tool and reading this, can do it like this:
In hope to help.
(PS: Thanks for you code, it is very useful)