Keep loosing Behavior Trees


New member
Hello. After using the undo command a couple of times while working on my (external) behavior tree, I lost all of my progress. Now when I try and open the external tree, Unity gets stuck on the Hold On window and after a while throws OutOfMemoryException: Out of memory error.

The error points to a couple of places in the BinaryDeserialization.cs script.

After creating another behavior tree, I accidentally used undo again (while adding a new shared variable) and this resulted in losing my behavior tree again. When opening the external tree, this time I get ArgumentNullException: Value cannot be null. Again pointing to a couple of places in the BinaryDeserialization.cs script.

Is there any way to recover my behavior tree?


Staff member
I'm sorry to hear that. Are you able to reproduce that exception? I'm curious what is causing it.

If it's an out of memory error chances are the serialized value is a corrupt value so there wouldn't be a way to recover other than to revert. This shouldn't happen though so I'm curious if you are able to reproduce. Do you have a revision that you can revert to?

To be safe you can also switch the serialization to JSON which is more recoverable than binary.


New member
Unfortunately I don't have a revision as the behavior tree was done in one go. I was thinking more about what would happen in the long run - I don't want to be losing whole behavior trees in a couple of ctrl+z clicks. I should mention that I am using a lot of custom SharedVariables so the problem might be somewhere there? Anyways, I have reconstructed the said behavior trees and switched to JSON (and also disabled record undo/redo option).

I will try to reproduce the bug later and get back to you but the problems are inconsistent and different each time.

Thanks for the quick reply!