Skip to content
This repository has been archived by the owner on Oct 13, 2022. It is now read-only.

StartNode add-delete-add issue #3

Open
AncientPixel opened this issue Jan 11, 2022 · 1 comment
Open

StartNode add-delete-add issue #3

AncientPixel opened this issue Jan 11, 2022 · 1 comment

Comments

@AncientPixel
Copy link

AncientPixel commented Jan 11, 2022

Hi guys, I love this graph implementation and I'm currently using it in a small side project.
Saying that, I have found a bug. 😄
When I add a Start node to a new graph, and then delete it and then try to add it again I get the following error:

ArgumentException: An item with the same key has already been added. Key: On Start System.Collections.Generic.Dictionary[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <bd21fd595d394493a51e7c79b5fef9e0>:0) System.Collections.Generic.Dictionary[TKey,TValue].Add (TKey key, TValue value) (at <bd21fd595d394493a51e7c79b5fef9e0>:0) RedOwl.Sleipnir.Engine.Node.DefineFlowPorts () (at Assets/Scripts/Engine/Node/Node.cs:127) RedOwl.Sleipnir.Engine.Node.Definition (RedOwl.Sleipnir.Engine.IGraph graph) (at Assets/Scripts/Engine/Node/Node.cs:94) RedOwl.Sleipnir.Engine.Graph.Add[T] (T node) (at Assets/Scripts/Engine/Graph/Graph.cs:128) RedOwl.Sleipnir.Editor.SleipnirGraphViewBase.CreateNode (RedOwl.Sleipnir.Engine.NodeAttribute data, UnityEngine.Vector2 position) (at Assets/Scripts/Editor/SleipnirGraphViewBase.cs:51)

[EDIT]: Ok I've found that if you stay on the graph window, and not reload the SerializedObject graph, this error happens. If you reload the graph this error wil not happen when adding a new Start node.

@AncientPixel
Copy link
Author

Ok a workaround is to call Reload() at the end of the OnGraphViewChanged() function in SleipnirGraphViewEditmode.cs
I could also just look for the offending Graph Port on the graph...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant