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
2k stars 415 forks source link

I deleted the ScriptableObjects in Assets/DefaultEditorResources/Node_Editor_Framework #199

Closed TimOgden closed 2 years ago

TimOgden commented 2 years ago

Hey, I was having some trouble with the Node Editor and I tried deleting the ScriptableObjects 'CurSession.asset' and 'LastSession.asset' from the folder Assets/DefaultEditorResources/Node_Editor_Framework.

I'm thinking this caused more issues, since now whenever I try to drag a node to move it or click on a TextField in the node, Unity silently crashes. Perhaps there is another reason for this, but this is my current guess.

I restored the files from the Recycle bin, but now 'CurSession.asset' and 'LastSession.asset' are missing their associated scripts, and I'm not sure what scripts they use. Any help would be appreciated, thanks!

Seneral commented 2 years ago

Deleting them would be my first move as well if you do not care about the data in them, they are just storing the currently opened canvas. Deleting them should prompt the editor to automatically recreate them, even if it was open. Did that not happen? Also, what did you do with the window during all this - e.g. delete while the window is closed, etc.?

TimOgden commented 2 years ago

I deleted them with the window open, tried reloading the canvas, closing and opening the window, and it never recreated the DefaultEditorResources asset files, but I realized that the actual 'CurSession.asset' and 'LastSession.asset' files in Assets/Plugins/Node_Editor_Framework were still working fine, and the Node Editor window still worked fine.

The reason for Unity crashing was that I tried to change the backgroundColor field in Node.cs to be a virtual property which I could override to have different colors for different types of nodes. I instead just added:

void OnEnable() {
    backgroundColor = [whatever color you want it to be]
}

on each of my different extensions of Node.cs.

Seneral commented 2 years ago

Ok then there still might be an issue, it should not switch locations unless you did that by moving them or by changing the settings here. If you install path is in Assets/, it should have used that path from the beginning, the logic of which can be found here. The reason it is so complex for a simple cache file path is because it has to be in the Assets folder, so when installed with the unity package manager it will have to be stored outside the Framework folder somewhere in Assets.

Also unity crashing due to virtual properties sounds wrong too. That too might just be an error somewhere in the framework as well, unless unity became a lot more unstable since I last used it