I’ve been poking around for a good example of how this might work but haven’t come up with much. The closest I’ve come to finding something is AngryAnt’s drag-and-drop script, which doesn’t look like it does quite what I want. In a nutshell:
You know how when you drag an AudioClip onto a GameObject in the Hierarchy window, it will either add an AudioSource component and set itself as the AudioClip for that AudioSource, or it will update the AudioClip property of an already existing AudioSource component on the object?
I want to duplicate that behavior, but with a custom asset type. So, I have a data type class, call it FooData, and I have a bunch of these in the Propery window. I want to be able to drag one of these items from the Project window onto a GameObject in the Hierarchy view and have it add a FooScript to that object if one doesn’t exist, setting itself into the FooData property of that script.
Anyone know if this is even possible?