FlowCanvas Forums › Support › NullReferenceException when playing a build version
Tagged: NullReferenceException ; Build
Hello,
We updated to 2.7.0 and we have an issue when playing a build version of our game, it displays this error and the flow canvas does not work :
NullReferenceException: Object reference not set to an instance of an object
at FlowCanvas.BinderConnection1[UnityEngine.Transform].DoNormalBinding (FlowCanvas.Port source, FlowCanvas.Port target) [0x0000d] in D:\ROCKETMAN\Assets\ParadoxNotion\FlowCanvas\Module\BinderConnection(T).cs:36
1[UnityEngine.Transform].Bind () [0x0001f] in D:\ROCKETMAN\Assets\ParadoxNotion\FlowCanvas\Module\BinderConnection(T).cs:23
at FlowCanvas.BinderConnection
at FlowCanvas.FlowNode.BindPorts () [0x0001a] in D:\ROCKETMAN\Assets\ParadoxNotion\FlowCanvas\Module\FlowNode.cs:127
at FlowCanvas.FlowGraph.OnGraphStarted () [0x00135] in D:\ROCKETMAN\Assets\ParadoxNotion\FlowCanvas\Module\FlowGraph.cs:116
at NodeCanvas.Framework.Graph.StartGraph (UnityEngine.Component agent, IBlackboard blackboard, Boolean autoUpdate, System.Action`1 callback) [0x00148] in D:\ROCKETMAN\Assets\ParadoxNotion\FlowCanvas\Framework\Runtime\Graphs\Graph.cs:586
at NodeCanvas.Framework.GraphOwner.StartBehaviour () [0x00034] in D:\ROCKETMAN\Assets\ParadoxNotion\FlowCanvas\Framework\Runtime\Graphs\GraphOwner.cs:99
at NodeCanvas.Framework.GraphOwner.Start () [0x00015] in D:\ROCKETMAN\Assets\ParadoxNotion\FlowCanvas\Framework\Runtime\Graphs\GraphOwner.cs:196
Has anybody encountered this issue ?
After some research on our end, we think it might be related to the use of a Transform value that was not referenced through the blackboard but directly pasted in the flow, do you think it might be something like this ?
It seems that the error occurs when the target port name of our nodes are empty strings (which happens a lot in our input and ouput flows). We think that in the previous version, those names were serialized as empty strings wereas they are serialized as a space character now, is that correct ?
Hey,
Yes, that is correct. Empty strings for port names, are now serialized as a whitespace. Do you have custom nodes made and if so, did that change created an issue for you? If yes, this behaviour can easily be changed in the source code of FlowNode.cs and in the “AddFlowInput”, “AddFlowOutput” methods.
Please let me know if that is the case.
Thanks.
Join us on Discord: https://discord.gg/97q2Rjh
Hi Gavalakis and mdemaille,
How are you doing?
Unfortunately I had this issue as well.
I get this error on iOs 11 after i updated to 2.7.0 on a Unity 5.6.0f3.
The error comes from a flow script that I know worked on iOs before the upgrade to 2.7.0. So it must be something due on the update.
NullReferenceException: A null value was found where an object instance was required.
at Basics.<Start>m__1 (Vector3 x) [0x00000] in <filename unknown>:0
at FlowCanvas.BinderConnection
1[T].Bind () [0x00000] in <filename unknown>:0
1[T].DoNormalBinding (FlowCanvas.Port source, FlowCanvas.Port target) [0x00000] in <filename unknown>:0
at FlowCanvas.BinderConnection
at FlowCanvas.BinderConnection.OnDestroy () [0x00000] in <filename unknown>:0
at FlowCanvas.FlowNode.BindPorts () [0x00000] in <filename unknown>:0
at FlowCanvas.FlowGraph.OnGraphStarted () [0x00000] in <filename unknown>:0
at FlowCanvas.BinderConnection.OnDestroy () [0x00000] in <filename unknown>:0
at NodeCanvas.Framework.Graph.StartGraph (UnityEngine.Component agent, IBlackboard blackboard, Boolean autoUpdate, System.Action1 callback) [0x00000] in <filename unknown>:0
1 callback) [0x00000] in <filename unknown>:0
at FlowCanvas.FlowGraph.OnGraphStarted () [0x00000] in <filename unknown>:0
at FlowCanvas.BinderConnection.OnDestroy () [0x00000] in <filename unknown>:0
at NodeCanvas.Framework.Graph.StartGraph (UnityEngine.Component agent, IBlackboard blackboard, Boolean autoUpdate, System.Action
at NodeCanvas.Framework.GraphOwner.StartBehaviour () [0x00000] in <filename unknown>:0
at NodeCanvas.Framework.GraphOwner.Start () [0x00000] in <filename unknown>:0
The main different is that I’m not able to know the Type involved (compared to the FlowCanvas.BinderConnection 1[UnityEngine.Transform].DoNormalBinding) that feature a Transform. I simply have a BinderConnection 1[T].
As far as I understood the issue is because the target port name of the nodes are empty strings, they should all be changed in ” ” (whitespace) in order to make everything work as expected.
As mdemaille shown on the screenshot I inspected the JSON from my flow script. Unfortunately I didn’t find any empty value on all _targetPortName, all are defined value or whitespace along with all
Is there a way for me to determine which is the node that returns the error ?
Is there a way to fix it automatically instead of re-create them one by one?
Thank you again,
Best,
Robert.
Hello Robert!
Sorry for the late reply.
I think I have found the cause of problem and although it requires a few changes to fix it, a rather faster quick fix, would be to please open up FlowNode.cs and in both the “GetInputPort” and “GetOutputPort” methods, please remove the “#if UNITY_EDITOR | #endif” directive, so that the code within in runs in the build as well.
There is a similar ‘#if UNITY_EDITOR’ directive in the method “DeserializePortValues” which you might also want to remove (keeping the code within the directive).
Please let me know whether this fixes the problem for you in the build application, or not.
Thank you.
Join us on Discord: https://discord.gg/97q2Rjh