The documentation is lacking when it comes to drag drop - I pretty much copied whatever I found and used that. Did you download and check the repo? Below is the code, its very simple and I dont see where it could corrupt. It is also curious that, without fail, (on my machine anyway) drag and drop will not work unless I do a drag and drop inside a native window… Are you performing drag/drop between 2 custom EditorWindows? Or between a custom window->native window or native window->custom window?
This is how we initiate the Drag
if (Event.current.type == EventType.mouseDrag new Rect(0,0,position.width,position.height).Contains(Event.current.mousePosition))
{
if(DragAndDrop.objectReferences.Length == 0)
{
DragAndDrop.PrepareStartDrag();
DragAndDrop.SetGenericData("currentValue", 50.0f);
DragAndDrop.StartDrag("Drag current value");
Event.current.Use();
}
}
and this is how we recieve it:
if (Event.current.type == EventType.dragUpdated || Event.current.type == EventType.dragPerform)
{
if (new Rect(0,0,position.width,position.height).Contains(Event.current.mousePosition))
{
float? b = DragAndDrop.GetGenericData("currentValue") as float?;
if (b.HasValue)
{
DragAndDrop.visualMode = DragAndDropVisualMode.Link;
if (Event.current.type == EventType.DragPerform)
{
DragAndDrop.AcceptDrag();
Event.current.Use();
Debug.Log(b.GetValueOrDefault());
}
}
}
}
which just log’s 50 if the drag and drop works as expect from one window to another.
I will honestly be over the moon if it is something I am doing wrong, but the code above is pretty basic stuff. I dont see where I could have stuffed up.
Furthermore, printing all Event.current.type’s for the receiving window shows that EventType.dragUpdated and EventType.dragPerform never actually happen. Not until I do a drag and drop inside a native Unity window. After that everything works, without fail, until I close Unity. No other corrupts after the first native drag/drop, never. I have been working on my tool all day and not a single problem with it, as long as I perform the work around
sorry for sounding a little upset, I have been stuck on this since Monday, and my only work around right now is to rework the tools workflow and how objects are passed between windows, which I do not want to do. I really want to believe its my fault right now, but I can’t see anything wrong and the evidance (on my end, anyway) points to another cause.
I am redownloading Unity and will do a fresh install and see if the error persists on the latest version for me. 