VariableInspector.SyncVariables is duplicating first 2 variables

shauntoast

New member
I have an external behaviour tree. It was originally created by duplicating another tree.
Add/edit variables in the Behavior Designer tab- all OK
Add a Behaviour Tree component to a gameobject, drag in the external behaviour - all OK

When the gameobject is reselected, the BT component inserts duplicates of the first 2 variables at the top of the list. This then causes the following error.

All of my variables seem to fail now.

I have tried removing all variables. It looks good until the component refreshes.

Code:
ArgumentException: An item with the same key has already been added. Key: bossLaser
System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <fb001e01371b4adca20013e0ac763896>: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)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <fb001e01371b4adca20013e0ac763896>: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 <fb001e01371b4adca20013e0ac763896>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <fb001e01371b4adca20013e0ac763896>:0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at <2cbbf8f8c622459ca9fa64194b7b6e6e>:0)
UnityEditor.HostView.Invoke (System.String methodName) (at <2cbbf8f8c622459ca9fa64194b7b6e6e>:0)
UnityEditor.HostView.OnSelectionChange () (at <2cbbf8f8c622459ca9fa64194b7b6e6e>:0)
 
Top