Enabled hook inside the Unity Editor#5
Conversation
|
I'm sorry but your changes don't make much sense and I won't include them. First of all your file count check is pretty pointless and for sure not the cause of the crash in the editor. It was most likely more related to native callbacks registrated in managed memory. In the current Unity version ( 2019.3.0f6 ) I don't have and kind of crash inside the editor if I re-enable the hook inside the editor. However I will keep it disabled anyways. Next is all your drop point adjustments to account for the editor offset it pretty pointless for several reasons. As I have repeatedly answered on other issues and pull requests, this script was never meant to work inside the editor. If was just kinda nice that (at least for me) it just worked. However other people have reported crashes when running unit-tests (no window created). Further more the gameview is the biggest issue. First of all the gameview doesn't need to be attached to the Unity main window. It could be part of a floating container window, maybe even on another monitor (I've had this setup a couple of times). So properly identifying the actual window is quite difficult. Depending on the used layout and Unity version most of your offsets would probably not work. Finally you replaced the callback null check with a null conditional operator which is a C# 6 feature. This makes the class incompatible with older versions of Unity for no reasons. So I don't really see a justified reason for your changes. For in-editor testing it's generally easier to setup test cases with hardcoded / configured test files. So the drag and drop support stays a standalone build feature. |
I discovered a cause of unity editor crash bug.
In unity editor, some times drag and drop file event does not have any file path.
So, I added file path count check.
And in unity editor, I added feature that OnDroppedFiles function invoke only in game view window.
I confirmed this in Unity 2019.3.0f6 and 2018.4.3f1.