Out of Memory Exception

regularde

New member
So i've been getting this out of memory exception, which i saw the old posts about. Started happening when i clicked a prefab i was using, and unity suddenly started saving it (though i didn't change anything?).

In any case, it uses an external tree and i set it to use JSON serialization., with Allow edit of instances
When I place new instances of the prefab, there are no problems, but the problem is in the scenes where I've already placed instances of the prefab. When i select them or play, it freezes until i get the out of memory exception.

Is there any way to fix this? I'm not sure why only the old instances of the prefab have this issue.

OutOfMemoryException: Out of memory
at (wrapper managed-to-native) System.Object.__icall_wrapper_ves_icall_array_new_specific(intptr,int)
at System.Collections.Generic.List`1[T].set_Capacity (System.Int32 value) [0x00021] in <eae584ce26bc40229c1b1aa476bfa589>:0
at System.Collections.Generic.List`1[T].EnsureCapacity (System.Int32 min) [0x00036] in <eae584ce26bc40229c1b1aa476bfa589>:0
at System.Collections.Generic.List`1[T].Add (T item) [0x00010] in <eae584ce26bc40229c1b1aa476bfa589>:0
at System.Collections.Generic.List`1[T].System.Collections.IList.Add (System.Object item) [0x00008] in <eae584ce26bc40229c1b1aa476bfa589>:0
at 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) [0x00235] in <ddb5579d0d23478c9f73ec2f99600079>:0
at BinaryDeserialization.LoadNodeData (BehaviorDesigner.Runtime.FieldSerializationData fieldSerializationData, System.Collections.Generic.Dictionary`2[TKey,TValue] fieldIndexMap, BehaviorDesigner.Runtime.Tasks.Task task) [0x000c7] in <ddb5579d0d23478c9f73ec2f99600079>:0
at BinaryDeserialization.LoadTask (BehaviorDesigner.Runtime.TaskSerializationData taskSerializationData, BehaviorDesigner.Runtime.FieldSerializationData fieldSerializationData, System.Collections.Generic.List`1[BehaviorDesigner.Runtime.Tasks.Task]& taskList, BehaviorDesigner.Runtime.BehaviorSource& behaviorSource) [0x00378] in <ddb5579d0d23478c9f73ec2f99600079>:0
at BinaryDeserialization.Load (BehaviorDesigner.Runtime.TaskSerializationData taskData, BehaviorDesigner.Runtime.BehaviorSource behaviorSource) [0x0026e] in <ddb5579d0d23478c9f73ec2f99600079>:0
at BehaviorDesigner.Runtime.BehaviorSource.CheckForSerialization (System.Boolean force, BehaviorDesigner.Runtime.BehaviorSource behaviorSource) [0x0007a] in <ddb5579d0d23478c9f73ec2f99600079>:0
at BehaviorDesigner.Runtime.BehaviorSource.GetAllVariables () [0x00000] in <ddb5579d0d23478c9f73ec2f99600079>:0
at BehaviorDesigner.Editor.BehaviorInspector.DrawInspectorGUI (BehaviorDesigner.Runtime.Behavior behavior, UnityEditor.SerializedObject serializedObject, System.Boolean fromInspector, System.Boolean& externalModification, System.Boolean& showOptions, System.Boolean& showVariables) [0x0029f] in <4b28e19850d5443cb0dab9a889df4542>:0
at BehaviorDesigner.Editor.BehaviorInspector.OnInspectorGUI () [0x00022] in <4b28e19850d5443cb0dab9a889df4542>:0
at UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () [0x00280] in <e6522990dfdf40458abbd5eeeb595b91>:0
1631670679443.png
 
Last edited:
So, i've sort of found a workaround, though like i said i only had this problem with older instances of the prefab. I ended up deleting the behavior tree component from the prefab so all instances across my scenes no longer had it, then readded it and set it up again. Now i no longer get this issue when i click the problematic instances.
 
Glad you found a solution. Based on the stack trace it looks like your tree is using binary serialization and when this happens generally the tree got corrupted in some way.
 
Top