I started getting this error “ArgumentException: An element with the same key already exists in the dictionary.” throughout all of my projects, even after re-installing Unity and flow Canvas, and on an empty project with only the Flow Canvas imported. The error occurs when I try to add a variable to a blackboard. The full error is below, I’m not a coder so its impossible for me to fix, any help would be great as I need it up and running again asap.
ArgumentException: An element with the same key already exists in the dictionary.
System.Collections.Generic.Dictionary2[System.Type,System.String].Add (System.Type key, System.String value) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:404)
ParadoxNotion.Design.EditorUtils.GetPreferedTypesSelectionMenu (System.Type type, System.Action1 callback, Boolean showInterfaces, UnityEditor.GenericMenu menu, System.String subCategory) (at Assets/ParadoxNotion/FlowCanvas/Framework/_Commons/Design/PartialEditor/EditorUtils/EditorUtils_ContextMenus.cs:67)
NodeCanvas.Editor.BlackboardEditor.ShowVariables (IBlackboard bb, UnityEngine.Object contextParent) (at Assets/ParadoxNotion/FlowCanvas/Framework/Design/PartialEditor/BlackboardEditor.cs:68)
NodeCanvas.Editor.GlobalBlackboardInspector.OnInspectorGUI () (at Assets/ParadoxNotion/FlowCanvas/Framework/Design/Editor/Inspectors/GlobalBlackboardInspector.cs:29)
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1229)
Thanks for the report.
It seems like there are somehow duplicate types exist in the Preferred Types editor list. Have you modified the Preferred Types list in the editor, and if so, can you please confirm that there is no duplicate types?
If the above is not the case, a quick fix for this would be to please open up EditorUtils_ContextMenus.cs file and replace line number #67 with this code:
Thanks for letting me know that this was the case.
Hmm. Normally, the same type can not be added on the list more than once (there is a preventing measure). I am really wondering how you managed to do that :). I will check the code again, in case I missed something though.