Seneral / Node_Editor_Framework

A flexible and modular Node Editor Framework for creating node based displays and editors in Unity
https://nodeeditor.seneral.dev
MIT License
2.01k stars 414 forks source link

Object Browser crashes the node editor #62

Closed Salepate closed 8 years ago

Salepate commented 8 years ago

Although it is suggested to only use GUI/GUILayout Elements inside a node, it may prove truly useful to have EditorGUI elements as well such as ObjectField(...). This, of course, is incompatible with runtime editing but it should not prevent unity editor to benefit from EditorGUI capabilities. Some may use this framework purely to create sequence of actions (my case), and never provide a runtime editor.

The control itself works and appear correctly inside the node. Drag'n'Drop function as well. But if you choose to reference object by using the native object browser: The editor goes out of control, loose current edited canvas because of the implemented exception catcher.

Any idea why?

image

After clicking on the bullseye :

image

image

Seneral commented 8 years ago

Hey Salepate! This is a (more or less widely) known problem within editor programming in unity, unfortunately. This should be fixed since a few months now, though. So please make sure you're using the latest version:) If you want to check yourself, you can look into Editor/Node_Editor/NodeEditorWindow.cs, in the GUI function you'll find the try-catch-block around the drawing function. What should catch all errors that are emmitted actually causes errors itself when using any picker field (ObjectField, ColorField, EnumField, etc.). For some reason those builtin fields cause the GUI to crash when called from within a try-catch block. I've found somewhat of a solution for this by only catching UnityExceptions, not the whole palette of System.Exception's. As I said I changed that in an (older) commit to only catch UnityExceptions but you can change that yourself if it's not yet set. It may alse be caused from a try-catch block you've set yourself of course, so please check that, too. Anyway, that should fix it hopefully!

Salepate commented 8 years ago

Hi,

I do use the latest version of this framework (freshly cloned today) in a newly created project, mainly for testing purpose. I do see that all exceptions are being caught currently (I am using the master branch by the way). I'll try by only catching UnityExceptions see if that fix the problem.

Thank you anyway

Regards,

Seneral commented 8 years ago

Oups, sorry then. Seems I forgot to merge that:/ Thanks for making me aware!

Seneral commented 8 years ago

I committed a hotfix for this bcba068 That should do it:)

Salepate commented 8 years ago

Thank you for the quick response!

Good framework by the way!

Seneral commented 8 years ago

No problem;) If you have suggestions, just drop by here on GitHub!