Find by Tag task using string variable -> Unity freeze Out of memory exception

Lemar

New member
Hi

How to reproduce the error:

1. Work with a prefab and autosave on
2. Use "Find by Tag" task
3. Create String variable to dynamically set the Tag on the Behaviour tree component
4. Reference that String variable in the Tag input on "Find by Tag" task

Save.

Select Game Object with that Behaviour tree in scene freezes Unity (currently using 2019.3 03-05 b)

After ca. 3-5min Unity is accessable again shows out of memory exception.
 
Last edited:
OutOfMemoryException: Out of memory
System.Collections.Generic.List`1[T].set_Capacity (System.Int32 value) (at <599589bf4ce248909b8a14cbe4a2034e>:0)
System.Collections.Generic.List`1[T].EnsureCapacity (System.Int32 min) (at <599589bf4ce248909b8a14cbe4a2034e>:0)
System.Collections.Generic.List`1[T].Add (T item) (at <599589bf4ce248909b8a14cbe4a2034e>:0)
System.Collections.Generic.List`1[T].System.Collections.IList.Add (System.Object item) (at <599589bf4ce248909b8a14cbe4a2034e>:0)
BinaryDeserialization.LoadField (BehaviorDesigner.Runtime.FieldSerializationData fieldSerializationData, System.Collections.Generic.Dictionary`2[TKey,TValue] fieldIndexMap, System.Type fieldType, System.String fieldName, System.Int32 hashPrefix, BehaviorDesigner.Runtime.IVariableSource variableSource, System.Object obj, System.Reflection.FieldInfo fieldInfo) (at <20126bbe51eb4fb0864ac4163de1de6e>:0)
BinaryDeserialization.LoadNodeData (BehaviorDesigner.Runtime.FieldSerializationData fieldSerializationData, System.Collections.Generic.Dictionary`2[TKey,TValue] fieldIndexMap, BehaviorDesigner.Runtime.Tasks.Task task) (at <20126bbe51eb4fb0864ac4163de1de6e>:0)
BinaryDeserialization.LoadTask (BehaviorDesigner.Runtime.TaskSerializationData taskSerializationData, BehaviorDesigner.Runtime.FieldSerializationData fieldSerializationData, System.Collections.Generic.List`1[BehaviorDesigner.Runtime.Tasks.Task]& taskList, BehaviorDesigner.Runtime.BehaviorSource& behaviorSource) (at <20126bbe51eb4fb0864ac4163de1de6e>:0)
BinaryDeserialization.Load (BehaviorDesigner.Runtime.TaskSerializationData taskData, BehaviorDesigner.Runtime.BehaviorSource behaviorSource) (at <20126bbe51eb4fb0864ac4163de1de6e>:0)
BehaviorDesigner.Runtime.BehaviorSource.CheckForSerialization (System.Boolean force, BehaviorDesigner.Runtime.BehaviorSource behaviorSource) (at <20126bbe51eb4fb0864ac4163de1de6e>:0)
BehaviorDesigner.Runtime.Behavior.CheckForSerialization () (at <20126bbe51eb4fb0864ac4163de1de6e>:0)
BehaviorDesigner.Runtime.BehaviorManager.LoadBehavior (BehaviorDesigner.Runtime.Behavior behavior, UnityEngine.GameObject behaviorGameObject, System.String gameObjectName, UnityEngine.Transform behaviorTransform) (at <20126bbe51eb4fb0864ac4163de1de6e>:0)
BehaviorDesigner.Runtime.BehaviorManager.EnableBehavior (BehaviorDesigner.Runtime.Behavior behavior) (at <20126bbe51eb4fb0864ac4163de1de6e>:0)
BehaviorDesigner.Runtime.Behavior.EnableBehavior () (at <20126bbe51eb4fb0864ac4163de1de6e>:0)
BehaviorDesigner.Runtime.Behavior.Start () (at <20126bbe51eb4fb0864ac4163de1de6e>:0)
 
I just tried to reproduce this but wasn't able to. Does it occur within a fresh project as well? What if you try JSON serialization?
 
I tried it again and it worked but the second I used the variable in another task I got the same error.
I forgot to mention that to reproduce one has to work with prefabs and autosave feature for prefabs must be on.

Could be related to another issue I ran into which I will describe in a second thread here

I saw that my issue is related to this thread:

That is exactly the problem I've and I suspect unitys autosave in a prefab feature to maybe be responsible for this. I think that performing some task in the behaviour designer are done to "slow", trigger Unitys autosave feature before the behaviour designer is fully done with what it is doing during task creation and when Unity is done saving, it throw changes afterward away, which leaves some behaviour tree in a state that is causing this OutOfMemory bug....
 
Last edited:
Top