I can say that this is not a common exception so hopefully you won't run into it again. If it does happen again can you copy the stack trace so I can see where it is coming from? If you are using JSON serialization you should be able to recover it - if you post your JSON string I should be able to see what is wrong.
Hi Justin, I have figured out how to reproduce this error, the problem may be caused by my custom shared variables which have cycle dependence.
Step 1: Create an empty game object attached behavior tree
Step 2: Create a one shared variable V and one task T(they hold references to each other), see the screenshot
Step 3: Add a variable of V on the behavior tree editor
Then the entire behavior tree will disappear and crash. here is the stack trace
KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <fb001e01371b4adca20013e0ac763896>:0)
BehaviorDesigner.Runtime.JSONDeserialization.Load (BehaviorDesigner.Runtime.TaskSerializationData taskData, BehaviorDesigner.Runtime.BehaviorSource behaviorSource) (at <3ed82e893f584901a16bc2e097c74b57>:0)
BehaviorDesigner.Runtime.BehaviorSource.CheckForSerialization (System.Boolean force, BehaviorDesigner.Runtime.BehaviorSource behaviorSource) (at <3ed82e893f584901a16bc2e097c74b57>:0)
BehaviorDesigner.Editor.GraphDesigner.Load (BehaviorDesigner.Runtime.BehaviorSource behaviorSource, System.Boolean loadPrevBehavior, UnityEngine.Vector2 nodePosition) (at <c30b522bd9d44078a580374210656c3e>:0)
BehaviorDesigner.Editor.BehaviorDesignerWindow.LoadBehavior (BehaviorDesigner.Runtime.BehaviorSource behaviorSource, System.Boolean loadPrevBehavior, System.Boolean inspectorLoad) (at <c30b522bd9d44078a580374210656c3e>:0)
BehaviorDesigner.Editor.BehaviorDesignerWindow.UpdateTree (System.Boolean firstLoad) (at <c30b522bd9d44078a580374210656c3e>:0)
BehaviorDesigner.Editor.BehaviorDesignerWindow.OnSelectionChange () (at <c30b522bd9d44078a580374210656c3e>: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 <bccb16a88ec4456dbf07978c418f407b>:0)
UnityEditor.HostView.Invoke (System.String methodName) (at <bccb16a88ec4456dbf07978c418f407b>:0)
UnityEditor.HostView.OnSelectionChange () (at <bccb16a88ec4456dbf07978c418f407b>:0)
I may avoid this in the future but I still want to know how to recover it if do it by accident, because it will lose all my work. it is scary.
"If you are using JSON serialization you should be able to recover it - if you post your JSON string I should be able to see what is wrong."
-- I don't understand what you mean, I didn't use any serialization things, I assume your team uses JSON to store the data of a behavior tree, but I didn't find the file location of that.