Kichang Kim
New member
When I set external behavior trees in runtime (about ~100 objects in single frame), multiple exceptions are occurred like this:
It seems that the internal caching system is not thread safe.
ArgumentException: An item with the same key has already been added. Key: 1908045651
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.JSONDeserialization.Load (BehaviorDesigner.Runtime.TaskSerializationData taskData, BehaviorDesigner.Runtime.BehaviorSource behaviorSource) (at Assets/Behavior Designer/Runtime/JSONDeserialization.cs:36)
BehaviorDesigner.Runtime.BehaviorSource.CheckForSerialization (System.Boolean force, BehaviorDesigner.Runtime.BehaviorSource behaviorSource) (at Assets/Behavior Designer/Runtime/BehaviorSource.cs:74)
BehaviorDesigner.Runtime.Behavior.CheckForSerialization (System.Boolean forceSerialization) (at Assets/Behavior Designer/Runtime/Behavior.cs:288)
BehaviorDesigner.Runtime.Behavior.CheckForSerialization () (at Assets/Behavior Designer/Runtime/Behavior.cs:274)
BehaviorDesigner.Runtime.Behavior.GetVariable (System.String name) (at Assets/Behavior Designer/Runtime/Behavior.cs:218)
ArgumentException: An item with the same key has already been added. Key: AAAAAAA - Behavior
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.BehaviorManager.LoadBehaviorComplete (BehaviorDesigner.Runtime.Behavior behavior, BehaviorDesigner.Runtime.BehaviorManager+BehaviorTree behaviorTree) (at Assets/Behavior Designer/Runtime/BehaviorManager.cs:473)
BehaviorDesigner.Runtime.BehaviorManager+<CheckThreadLoaders>d__75.MoveNext () (at Assets/Behavior Designer/Runtime/BehaviorManager.cs:364)
It seems that the internal caching system is not thread safe.