If I have a Unity app running in a browser or just in a window natively on a machine is it possible ot get it to accept files I drag and drop into it? Like I grab a jpeg and drag it over the unity window and just drop it, could unity grab that and read it in (possibly also load it up froma file directory).
Just trying to see if I can make something like a photogallery using unity...
Answer by Graham-Dunnett
Nov 27, 2011 at 11:03 PM
Am pretty sure that Unity applications do not respond to the WM_DROPFILES windows message, so, no, I don't think you can do that.
how does the unity editor work then?
@JabberWorx: The UnityEditor is written as a native application with full control over all system messages. As a user of Unity you only can use what the scripting environment allows / offers you. As Graham said the message pump of windows belongs to the application itself. Even when you use DragAcceptFiles you can't receive the WM_DROPFFILES message in your scripts.
Well it would be possible to subclass the main window from a native plugin but it's more a hack than a solution. For webbuilds there is absolutely no way.
editI've just posted a feature request for drag&drop support here. Feel free to vote ;)
File drag & drop to the Unity window of Windows and OS X standalone builds would be extremely useful to me. I'm happy to hear I'm not the only one.
The last comment on this question was a few years ago.. does anyone know if there has been any progress on this, and if it is possible to achieve this in Unity 5?
I search something like that as well but have not found anything for Windows, MacOSX or Linux yet...
The best thing I found is for WebGL only: https://www.assetstore.unity3d.com/en/#!/content/25846
I think you may be able to program a plugin into unity to add this however I cannot suggest how that would work, I guess grab a book on the Windows OS and try and figure it out? It would be hard.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
8 People are following this question.
Drag and drop 3d game
Dragging an object in iOS (UnityScript)
Drag and droping from GUI
Spawn new object after last one is dragged away
How do I detect OnDrop event on a GameObject?