Errors when converting to prefab


New member
Hello !

I am having an issue where I am using the behavior trees just fine up until now, but only when it is on objects directly in the scene.

Whenever I am trying to convert a gameObject that has a behaviorTree on it, I will have this error when I open the prefab itself and of course the behavior tree is not working anymore ( I am using external behavior tree )

"InvalidCastException : Specified Cast is not valid,
BinaryDeserialization.BytesToSharedVariable (BehaviorDesigner.Runtime.FieldSerializationData fieldSerializationData, System.Collections.Generic.Dictionary`2[TKey,TValue] fieldIndexMap, System.Byte[] bytes"

How could I fix that ? Did anyone succesfully using their behavior trees with prefabs ?

Thanks !


Staff member
If you switch to JSON serialization (BD Preferences on the top right of the editor) then you'll use a different serialization method. But binary serialization should also work - can you send a repro package to so that I can take a look.