Drag and Drop file in runtime
hey guys. im using this code to register my window for drag and drop event but unity just crashes. if I use null for the second Parameter of RegisterDragAndDrop function it doesn't crash. I added all .dll files in my plugin floder and api is on .NET 2.0.
using UnityEngine;
using System.Runtime.InteropServices;
using System;
using System.Windows.Forms;
public class Test : MonoBehaviour{
[DllImport("user32.dll")]
private static extern System.IntPtr GetActiveWindow();
[DllImport("ole32.dll")]
static extern uint RegisterDragDrop(IntPtr hwnd,IDropTarget dropTarget);
// Use this for initialization
void Start()
{
IDropTarget dropTarget = new Drop();
RegisterDragDrop(GetActiveWindow(), dropTarget);
}
class Drop : IDropTarget
{
public Drop()
{
}
void IDropTarget.OnDragDrop(DragEventArgs e)
{
throw new NotImplementedException();
}
void IDropTarget.OnDragEnter(DragEventArgs e)
{
throw new NotImplementedException();
}
void IDropTarget.OnDragLeave(EventArgs e)
{
throw new NotImplementedException();
}
void IDropTarget.OnDragOver(DragEventArgs e)
{
throw new NotImplementedException();
}
}
}
any help will be appreciated
Hi!
Do you found any possible solution for this? I just facing almoast the same problem, for me It is not crash but the drop functionallyti is still blocked to the build window.
Edit: The editor is crashing for me also, the build is not
Your answer
Follow this Question
Related Questions
Game runs in Editor, crashes on startup after build. "Access Violation (0xc0000005)" 3 Answers
Fatal signal 11 (SIGSEGV), code 1, fault addr 0x50 0 Answers
Program Crash 1 Answer
Unity 4.6 | 4.7 AdMob iOS Crash 0 Answers
Crash Unity 5.3.5 on startup 0 Answers