FlowCanvas Forums › Support › Crash when deleting nodes or removing connections. › Reply To: Crash when deleting nodes or removing connections.
Hey,
So I have taken a deeper look at this and I still can’t figure out why it is crashing sometimes but I did discovered something very strange. Whenever a FlowController
component exists within the same GameObject as an UnityEngine.UI.Image
component within a Nested Prefab setup (!thats the important part!), the graph starts behaving extremely strangely very reminiscent of the problems I would see before it would eventually crash.
I have made a example project as well as a video show the problem. Hopefully it can point to what is going on. I also went through the code with the debugger and noticed that there is a peculiar bug that happens when in this configuration when trying to add or delete nodes and node connections (which is usually where the crash occurs).
Specifically, in the NodeCanvas.Framework.Graph.AssignNodeID()
method of theĀ ParadoxNotion\Assets\ParadoxNotion\CanvasCore\Framework\Runtime\Graphs\Graph.cs :
class at line 458
, sometimes the value of lastID
will be larger than the contents of the parsed
Node[]
list for some reason. I’m not sure if this is related or a separate issue.
In context:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
//Used above to assign a node's ID and list order int AssignNodeID(Node node, int lastID, ref Node[] parsed) { if ( !parsed.Contains(node) ) { lastID++; node.ID = lastID; parsed[lastID] = node; // <-------------------------- This array lookup right here returns an out of bounds exception sometimes. for ( var i = 0; i < node.outConnections.Count; i++ ) { var targetNode = node.outConnections<em class="d4pbbc-italic"></em>.targetNode; lastID = AssignNodeID(targetNode, lastID, ref parsed); } } return lastID; } |
I recommend you take a look at the video first and then you can get in touch with me and I can send you the demo project I have if you want to take a look at it on your side (I don’t want to distribute your plugin by linking the demo project publicly). I am also on the Discord channel, if it is any easier we can talk over there.
Here is the screen capture video that illustrates the glitch:
https://youtu.be/PPiRTGWTtts