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

Can't load a canvas file in Play mode #19

Closed pmhpereira closed 8 years ago

pmhpereira commented 8 years ago

When loading a canvas file while in Play mode, nothing appears in the Node Editor. Adding nodes manually and saving files works normally.

Steps to reproduce:

  1. Start Play mode in Unity
  2. Load Canvas file
Seneral commented 8 years ago

Did you used the RuntimeNodeEditor Component? If so, please make sure you specified a path to the Canvas asset in the component, I've yet to make other ways to load a canvas. It's still a demo, there's no other way yet:) You can do it though, I'd appreciate that;)

pmhpereira commented 8 years ago

Thanks for the quick answer on both issues!

I really need the Game and the Node Editor to be in separated windows, so this is really not a solution for me. I'll see if I can make the Node Editor keep its context between Editor and Play mode. :-)

Seneral commented 8 years ago

Oh, so I understood your issue wrong, I thought you meant the playmode Node Editor. I just reproduced this, I'll take a look what causes this. Don't worry, this is not inteded;)

Seneral commented 8 years ago

Ok after I looked into it, it's actually a mistake on my side that I should have been aware of... In NodeEditor.LoadNodeCanvas (l. 933), replace

if (!Application.isPlaying) 
{
#if UNITY_EDITOR
    objects = UnityEditor.AssetDatabase.LoadAllAssetsAtPath (path);
#endif
}
else 
{
    path = path.Split ('.') [0];
    objects = UnityEngine.Resources.LoadAll (path);
}

with

#if UNITY_EDITOR
    objects = UnityEditor.AssetDatabase.LoadAllAssetsAtPath (path);
#else
    path = path.Split ('.') [0];
    objects = UnityEngine.Resources.LoadAll (path);
#endif

which should fix it. Btw I still don't know why in playmode the knob textures get tinted that extremely blue, probably a similar problem I need to figure out:) Thanks for tracking these bugs down;)