NodeCanvas Forums › Support › Losing BB variables/references after compiling
Hello,
I’ve been using NodeCanvas for a few weeks, really happy with the product, but I have a problem.
I setup a (bound) FSM with references to Blackboard variables (or gameobjects in scene) in Action State. Then, if I make a mistake in one of my scripts (even a non-FSM related one) and compile, the FSM displays Action States comments in red, surrounded by asterisks, and a “Missing Action” for every Action Tasks (even though the action tasks scripts are still here and have no errors in them) — see picture 1.png.
Now, If I correct the mistake in my badly coded script and compile again, the FSM is back to normal (no more comments in red and the action tasks are back) but I lose all my Blackboard variables references in action tasks, as well as the Blackboard variables themselves (they are still here but not assigned to the correct object type). I have to manually add them back, which is very time-consuming.
Do you have any idea what would cause this problem ?
Thank you very much for your help
Hello,
Thanks. I am glad you like NodeCanvas.
Do you have by any chance moved NodeCanvas folder under a “Plugins” or “Standard Assets” named folder in your project?
Let me know.
Thanks.
Join us on Discord: https://discord.gg/97q2Rjh
Yes, I moved it to my “Plugins” folder. Should I move it somewhere else ?
Hey,
Yes, Please move the NodeCanvas folder outside of the Plugins folder to avoid this problem. The reason this is happening is because everything in the Plugins folder is compiled in a different assembly than everything outside of it.
Let me know if this works for you.
Thanks.
Join us on Discord: https://discord.gg/97q2Rjh
Yes, this is working. I’m not losing all Action tasks and BB references anymore. Thank you very much !
However, the NodeCanvas window is still going temporarily bonkers if I try to compile with bad code somewhere. The window will close while throwing hundreds of errors in the console (see picture). If I correct my mistake and recompile, the window is back again (after throwing another round of errors) and everything is working fine. Is this normal behavior ?
Hello again,
You are very welcome 🙂
Hmm. No, this is not a normal behaviour. The window should work in both cases correctly. I think you forgot to attach the image though 🙂
Can you please do so, and also copy-paste for me the errors show in the console?
Also, what Unity version are you under?
Thanks in advance!
Join us on Discord: https://discord.gg/97q2Rjh
The behavior described above just changed a little bit after I relaunched Unity (5.3.5f1). Here is the detailed description :
1- I have a perfectly fine FSM window, everything is working. I introduced a small mistake anywhere in the code and CTRL-R to recompile.
2- The FSM Window completely disappears. If I go to Tools/ParadoxNotion in the Unity Menu bar, the submenu does not appear. If I go to the gameobject the FSM is attached to, I have the FSM Owner Component displaying only the script name (FSMOwner) and then a grayed out line with “Start Called” and an unchecked checkbox. The “Edit FSM” button is not present. The Blackboard component below displays the script name (Blackboard) and a line with “Serialized Blackboard” followed by a string. Third line is an empty Object Reference array.
3- Correcting the mistake and CTRL-R to recompile. First error thrown in the console :
NullReferenceException: Object reference not set to an instance of an object
1 2 3 4 |
[Exception] NullReferenceException: Object reference not set to an instance of an object 0. UnityEngine.UI.Graphic.OnRebuildRequested() at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Graphic.cs:480 1. UnityEngine.UI.GraphicRebuildTracker.OnRebuildRequested() at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/GraphicRebuildTracker.cs:33 2. UnityEngine.CanvasRenderer.RequestRefresh() at C:/buildslave/unity/build/artifacts/generated/common/modules/UI/CanvasRendererBindings.gen.cs:314 |
Then more than 300 identical errors :
1 2 |
MissingReferenceException: The object of type 'Object' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object. |
1 2 3 4 5 6 7 |
[Exception] MissingReferenceException: The object of type 'Object' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object. 0. UnityEditor.Editor.IsEnabled() at C:/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:589 1. UnityEditor.InspectorWindow.DrawEditor() at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1151 2. UnityEditor.InspectorWindow.DrawEditors() at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1028 3. UnityEditor.InspectorWindow.OnGUI() at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:352 4. MonoMethod.Invoke() at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222 |
Then at the end, this single error :
Exception: Error while parsing: unable to parse; invalid token "="; context = <=null]]"}}}s":{"bb_CurrentBrain":{"_value":{},"_na>
1 2 3 4 5 6 |
[Exception] Exception: Error while parsing: unable to parse; invalid token "="; context = <=null]]"}}}s":{"bb_CurrentBrain":{"_value":{},"_na> 0. fsResult.AssertSuccess() at Assets/ParadoxNotion/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsResult.cs:147 1. fsJsonParser.Parse() at Assets/ParadoxNotion/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsJsonParser.cs:495 2. JSONSerializer.Deserialize() at Assets/ParadoxNotion/NodeCanvas/Framework/_Commons/Runtime/Serialization/JSONSerializer.cs:81 3. JSONSerializer.Deserialize[BlackboardSource]() at Assets/ParadoxNotion/NodeCanvas/Framework/_Commons/Runtime/Serialization/JSONSerializer.cs:61 4. Blackboard.OnAfterDeserialize() at Assets/ParadoxNotion/NodeCanvas/Framework/Runtime/Variables/Blackboard.cs:43 |
(bb_CurrentBrain is one of my BB variable)
4- The window is still missing. But if I click away in the hierarchy then click back to the gameobject owning the FSM, the FSM window then immediately pops up back on the screen, and the FSM is then working fine.
Thank you very much for taking the time to help me !
Hello again,
This is a very weird error you are facing here and the first time I’ve been reported such issues :/
Before I dig further into what can potentially be going wrong here, is it possible for you at all to please send me the project (or another project showcasing these problems) to support@paradoxnotion.com ?
Taking a look at it would greatly help figuring the problem out and help you.
I hope that is possible. Let me know.
Thanks in advance!
Join us on Discord: https://discord.gg/97q2Rjh
Unfortunately I can’t send you the whole project. I tinkered a little bit this morning and I think that the errors I copy/pasted earlier are unrelated to Node Canvas. This is some kind of weird unity bugs when editor is refreshing (probably this problem but I can’t fix it in my current project).
On the other hand, I started a new blank project, created a bound FSM, then create a mistake in my code and recompile. The FSM window disappeared (“Failed to Load” on the tab title) and the Paradox Notion submenu in the Tools Menu in the Unity menu bar is not available anymore. If I fix the mistake and recompile, I can access the FSM window again and everything is working fine. Is this a normal behavior, or should the FSM window stays open despite compiling with error ?
Again, thanks for your help.
Hello,
Thanks for letting me know.
Normally, the NodeCanvas window should stay open even when there is compilation error since if there is a compilation error, Unity will not recompile of course and instead will use the last successful compilation. I think in one specific version of Unity though, this was not working as expected (bug?) but can’t remember which version exactly this was happening on. What platform are you under and which version of Unity are you using?
Thanks.
Join us on Discord: https://discord.gg/97q2Rjh
Sorry for the delay, I was in vacation. I switched to Unity 5.4 a few days ago, disabled auto-compile on refresh and I don’t have problems anymore. Thank you very much for your help.
Hey,
No problem! I hope you had a good time 🙂 and I am glad that the issue is resolved in Unity 5.4.
Thanks for letting me know!
Join us on Discord: https://discord.gg/97q2Rjh