- Home /
Drag and drop an external file/folder into a running game window?
Hi all,
Is there any way I can drag and drop an external file or folder into a running Unity game window, and at least be able to determine the file path?
I am basically wanting to create a model viewer and would be very handy to do this, but having trouble finding information on whether this is possible or not.
thanks,
Allan
Answer by soft_sound · Mar 25, 2015 at 01:13 AM
I'm not sure about drag and drop but it is quite possible to get the path of any asset or load an asset from an external source.
var path = EditorUtility.OpenFilePanel("Load RTF note file", "", "");
I use this to load notes into Unity.
There is also the whole AssetDatabase thing to check out.
Thanks, I've used that approach before and that will be a good enough solution for now. Really only for convenience being able to drag-drop.
Cheers
If my comment was useful you could make it as an answer ;)
Also this similar post may help you more. -> Applying variable from project
The post refers to ObjectNames.GetDragAndDropTitle which might be useful, never tried it so I don't know.
This may be useful later if you want more stats from your model $$anonymous$$odelImporter Class
Answer by Astiolo · Feb 22, 2018 at 03:50 AM
Bunny83 has made some code that can do this. It's really simple to use. https://github.com/Bunny83/UnityWindowsFileDrag-Drop