ArgumentException: An item with the same key has already been added

mostlyhuman

Member
Getting this error:

ArgumentException: An item with the same key has already been added. Key: -1296789370
System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <437ba245d8404784b9fbab9b439ac908>:0)
BinaryDeserialization.Load (BehaviorDesigner.Runtime.TaskSerializationData taskData, BehaviorDesigner.Runtime.BehaviorSource behaviorSource) (at <b3033df3de7e4331a53ff33bc57a3e9d>:0)
BehaviorDesigner.Runtime.BehaviorSource.CheckForSerialization (System.Boolean force, BehaviorDesigner.Runtime.BehaviorSource behaviorSource) (at <b3033df3de7e4331a53ff33bc57a3e9d>:0)
BehaviorDesigner.Editor.GraphDesigner.Load (BehaviorDesigner.Runtime.BehaviorSource behaviorSource, System.Boolean loadPrevBehavior, UnityEngine.Vector2 nodePosition) (at <d917a79751444cb5b4a389f044c18334>:0)
BehaviorDesigner.Editor.BehaviorDesignerWindow.LoadBehavior (BehaviorDesigner.Runtime.BehaviorSource behaviorSource, System.Boolean loadPrevBehavior, System.Boolean inspectorLoad) (at <d917a79751444cb5b4a389f044c18334>:0)
BehaviorDesigner.Editor.BehaviorDesignerWindow.ReloadPreviousBehavior () (at <d917a79751444cb5b4a389f044c18334>:0)
BehaviorDesigner.Editor.BehaviorDesignerWindow.OnFocus () (at <d917a79751444cb5b4a389f044c18334>:0)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <437ba245d8404784b9fbab9b439ac908>:0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at <78f1ad0f25c84e3ca853e639f50d95f5>:0)
UnityEditor.HostView.Invoke (System.String methodName) (at <78f1ad0f25c84e3ca853e639f50d95f5>:0)
UnityEditor.HostView.OnFocus () (at <78f1ad0f25c84e3ca853e639f50d95f5>:0)
 

mostlyhuman

Member
It happened in an older project that I had upgraded to 2019.3, I did upgrade to the latest version of BD afterwards and the error was still there but now reopening the project the error is gone. If it pops up again I will send it over.
 

172326229

New member
I have the same error when I using External Behaviour. Unity version is 2020.3.10f1c2.

ArgumentException: An item with the same key has already been added. Key: DistanceShotMaxValid
System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <695d1cc93cca45069c528c15c9fdd749>:0)
BehaviorDesigner.Runtime.BehaviorSource.UpdateVariablesIndex () (at <58623c9461324266a5b7839460bb9d26>:0)
BehaviorDesigner.Runtime.BehaviorSource.SetAllVariables (System.Collections.Generic.List`1[T] variables) (at <58623c9461324266a5b7839460bb9d26>:0)
BehaviorDesigner.Runtime.JSONDeserialization.DeserializeVariables (BehaviorDesigner.Runtime.IVariableSource variableSource, System.Collections.Generic.Dictionary`2[TKey,TValue] dict, System.Collections.Generic.List`1[T] unityObjects) (at <58623c9461324266a5b7839460bb9d26>:0)
BehaviorDesigner.Runtime.JSONDeserialization.Load (BehaviorDesigner.Runtime.TaskSerializationData taskData, BehaviorDesigner.Runtime.BehaviorSource behaviorSource) (at <58623c9461324266a5b7839460bb9d26>:0)
BehaviorDesigner.Runtime.BehaviorSource.CheckForSerialization (System.Boolean force, BehaviorDesigner.Runtime.BehaviorSource behaviorSource) (at <58623c9461324266a5b7839460bb9d26>:0)
BehaviorDesigner.Editor.BehaviorDesignerWindow.LoadBehavior (BehaviorDesigner.Runtime.BehaviorSource behaviorSource, System.Boolean loadPrevBehavior, System.Boolean inspectorLoad) (at <d4f1a3aa6f1a495496d6efce8625ce9a>:0)
BehaviorDesigner.Editor.BehaviorDesignerWindow.UpdateTree (System.Boolean firstLoad) (at <d4f1a3aa6f1a495496d6efce8625ce9a>:0)
BehaviorDesigner.Editor.BehaviorDesignerWindow.OnSelectionChange () (at <d4f1a3aa6f1a495496d6efce8625ce9a>:0)
UnityEditor.HostView.OnSelectionChange () (at <a9d6276083484759be43f20e6e92863e>:0)

DistanceShotMaxValid has two rows.
If I delete DistanceShotMaxValid, then HomePosition has tow rows.
 

Attachments

  • OpsiveBug.png
    OpsiveBug.png
    39.3 KB · Views: 1
Last edited:
Top